Skip to content

Instantly share code, notes, and snippets.

@hutt
Created April 5, 2016 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hutt/2bee614bb50b00d5eafc96433f3269ca to your computer and use it in GitHub Desktop.
Save hutt/2bee614bb50b00d5eafc96433f3269ca to your computer and use it in GitHub Desktop.
get notified easily by using pushover on your server.
#!/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