Last active
December 17, 2022 12:28
Revisions
-
rubenhorn revised this gist
Dec 17, 2022 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,6 @@ while true do curl -s $HOST/$TOPIC/json --max-time $TIMEOUT | jq -c 'select(.event == "message")' | while IFS= read -r JSON do TITLE="$(echo $JSON | jq -r '.title')" MESSAGE="$(echo $JSON | jq -r '.message')" notify-send -a "$HOST/$TOPIC" $TITLE $MESSAGE -
rubenhorn created this gist
Dec 17, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #! /bin/sh HOST="ntfy.sh" TOPIC="hh2WuvyfG7dN8tQx8ZxLF8wE" TIMEOUT=10 # Hack to get around issue of output not being piped while true do curl -s $HOST/$TOPIC/json --max-time $TIMEOUT | jq -c 'select(.event == "message")' | while IFS= read -r JSON do echo $JSON | jq TITLE="$(echo $JSON | jq -r '.title')" MESSAGE="$(echo $JSON | jq -r '.message')" notify-send -a "$HOST/$TOPIC" $TITLE $MESSAGE done done This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #! /bin/sh HOST="ntfy.sh" TOPIC="my-topic" if [ $# == 1 ] then TITLE="ntfy.sh" MESSAGE="$1" elif [ $# == 2 ] then TITLE="$1" MESSAGE="$2" else echo "Usage: $0 [TITLE] <MESSAGE>" exit 1 fi curl -H "Title:$TITLE" -d "$MESSAGE" $HOST/$TOPIC &> /dev/null