Skip to content

Instantly share code, notes, and snippets.

@victor-oliveira1
Created October 19, 2021 18:00
Show Gist options
  • Save victor-oliveira1/c1c1f0966c8247415bca26e1e3ff39d1 to your computer and use it in GitHub Desktop.
Save victor-oliveira1/c1c1f0966c8247415bca26e1e3ff39d1 to your computer and use it in GitHub Desktop.
Send messages from bash using Pushover service
#!/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