From ed5064cbb1239ad3e2f0780f782c9d6a4f980161 Mon Sep 17 00:00:00 2001 From: Mark Hoekveen Date: Fri, 1 Sep 2023 22:13:48 +0200 Subject: [PATCH] pushover script --- .scripts/pushover | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 .scripts/pushover diff --git a/.scripts/pushover b/.scripts/pushover new file mode 100755 index 0000000..c685498 --- /dev/null +++ b/.scripts/pushover @@ -0,0 +1,25 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + exit +fi + +MESSAGE=$1 +TITLE=$2 + +if [ $# -lt 2 ]; then + TITLE=$HOSTNAME +fi + + +# wget https://api.pushover.net/1/messages.json --post-data="token=$APP_TOKEN&user=$USER_TOKEN&message=$MESSAGE&title=$TITLE" -qO- > /dev/null 2>&1 & +cmd="curl -s \ + --form-string 'token=$PUSHOVER_APP_TOKEN' \ + --form-string 'user=$PUSHOVER_USER_TOKEN' \ + --form-string 'message=$MESSAGE' \ + --form-string 'title=$TITLE' " +if [ $# -ge 3 ]; then + cmd="$cmd -F 'attachment=@$3'" +fi +cmd="$cmd https://api.pushover.net/1/messages.json" +eval $cmd