notify.sh.j2 (643B)
1 #!/bin/bash 2 # Usage: notify "title" "message" 3 # notify "message" (uses default title "MakeMKV") 4 5 PUSHOVER_TOKEN="{{ pushover_app_token }}" 6 PUSHOVER_USER="{{ pushover_user_key }}" 7 PUSHOVER_URL="https://api.pushover.net/1/messages.json" 8 9 case $# in 10 1) TITLE="MakeMKV" ; MESSAGE="$1" ;; 11 2) TITLE="$1" ; MESSAGE="$2" ;; 12 *) echo "Usage: notify [title] message" >&2; exit 1 ;; 13 esac 14 15 curl -s --max-time 10 \ 16 -F "token=$PUSHOVER_TOKEN" \ 17 -F "user=$PUSHOVER_USER" \ 18 -F "title=$TITLE" \ 19 -F "message=$MESSAGE" \ 20 "$PUSHOVER_URL" > /dev/null \ 21 || echo "Warning: Pushover notification failed" >&2