Created
October 19, 2021 18:00
-
-
Save victor-oliveira1/c1c1f0966c8247415bca26e1e3ff39d1 to your computer and use it in GitHub Desktop.
Send messages from bash using Pushover service
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
#!/usr/bin/env bash | |
# pushover-notify | |
# Send notifications using the Pushover service | |
# Example: | |
# - $ pushover-notify "Test Message" | |
# Victor Oliveira <[email protected]> | |
SECRETS="${HOME}/.pushover/secrets" | |
test -a "${SECRETS}" || { | |
echo "Missing token and user from ${SECRETS}" | |
exit 1 | |
} | |
sendMsg() { | |
local MSG="${1}" | |
curl \ | |
$(while read LINE; do echo --form-string "${LINE}"; done < "${SECRETS}") \ | |
--form-string "message=${MSG}" \ | |
https://api.pushover.net/1/messages.json | |
} | |
sendMsg "${1}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment