diff --git a/chertex.sh b/chertex.sh index 6d0375e..349b6fb 100755 --- a/chertex.sh +++ b/chertex.sh @@ -449,10 +449,19 @@ cetcest=$(date +%Z) endtime=$(date +%s) runtime=$(( $endtime - $starttime )) -# send push message via Gotify CLI +# send push message to Gotify server # if runtime is longer than X minutes (suitable limit perhaps 3 min) -if (( $runtime > 180 )); then - gotify push --quiet --title "$dir_wd" --priority 5 "chertex.sh $@ \nCompleted in $runtime s" +if (( $runtime > 70 )); then + # POST request to Gotify server works without needing Gotify CLI on this box + # NOTE, multi-line bash command fails if interrupted by comment lines! + # Hide CURL response (-o /dev/null) and progress bar (--silent) + # https://gotify.net/docs/pushmsg + curl -X POST "https://gotify.chepec.se/message?token=A8nO3zYJ-R1wG__" \ + -F "message=chertex.sh $@. Completed in $runtime s" \ + -F "title=$dir_wd" -F "priority=5" \ + -o /dev/null --silent + # https://stackoverflow.com/questions/3872427/how-to-send-line-break-with-curl + # I could not make multi-line message (to Gotify) work here, however I tried. Giving up for now. msg "Push notification sent to Gotify" fi