Skip to content
Snippets Groups Projects
Commit 4efc8d40 authored by nimrod's avatar nimrod
Browse files

Fix and debugging for spammer.

- Add my local scripts to the path (broke in
e3966f76).
- Output some information to the syslog.
- A little better handling of errors.
parent 7803dd3b
No related branches found
No related tags found
No related merge requests found
Pipeline #141 passed
#!/bin/sh #!/bin/sh
set -eu set -eu
export PATH="$HOME/Documents/bin:$PATH"
URL='https://patchbay.pub/pubsub/1446c969-9a54-4b5b-83e0-bf88f22f289d' URL='https://patchbay.pub/pubsub/1446c969-9a54-4b5b-83e0-bf88f22f289d'
while true while true
do do
message="$(curl --silent "$URL")" message="$(curl --silent "$URL" || true)"
exitstatus="$?" exitstatus="$?"
# Backoff in case of an error.
if [ -z "${message:-}" ] || [ "$exitstatus" -gt '0' ]
then
sleep 1
break
fi
logger --tag "spammer" "$message"
if echo "$message" | grep --silent '^message=' if echo "$message" | grep --silent '^message='
then then
message="$(echo "$message" | sed 's/message=//; s/+/ /g')" message="$(echo "$message" | sed 's/message=//; s/+/ /g')"
...@@ -14,9 +22,4 @@ do ...@@ -14,9 +22,4 @@ do
echo "$message" | notify \ echo "$message" | notify \
--urgency low \ --urgency low \
--hint "string:desktop-entry:spammer" --hint "string:desktop-entry:spammer"
# Backoff in case of an error.
if [ "$exitstatus" -gt '0' ]
then
sleep 1
fi
done done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment