Created
April 5, 2016 16:07
-
-
Save hutt/2bee614bb50b00d5eafc96433f3269ca to your computer and use it in GitHub Desktop.
get notified easily by using pushover on your server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Pushover settings | |
api_key="YOUR_API_KEY" | |
user_key="YOUR_USER_KEY" | |
# Logic | |
if [ -t 0 ]; then | |
# check for parameters | |
text=$* | |
if [ -n text ] | |
then | |
curl -s \ | |
--form-string "token=$api_key" \ | |
--form-string "user=$user_key" \ | |
--form-string "message=$text" \ | |
https://api.pushover.net/1/messages.json | |
else | |
echo "no input given." | |
fi | |
else | |
# no parameters; read line | |
read text | |
curl -s \ | |
--form-string "token=$api_key" \ | |
--form-string "user=$user_key" \ | |
--form-string "message=$text" \ | |
https://api.pushover.net/1/messages.json | |
fi | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment