- Get the App:
- Register usig your phone number
- Signal CLI for sending messages:
# Defining alias for docker/podman run command so we need to type less
# Mounting config folder into the container to persist linking between container runs
# for podman
alias signal='podman run -it --rm --name signal-cli --volume $HOME/.config/signalcli:/var/lib/signal-cli:Z --tmpfs /tmp:exec registry.gitlab.com/packaging/signal-cli/signal-cli-jre:latest --config /var/lib/signal-cli'
# for docker ( i hope so at least. haven't tested this )
alias signal='docker run -it --rm --name signal-cli --volume $HOME/.config/signalcli:/var/lib/signal-cli --tmpfs /tmp:exec registry.gitlab.com/packaging/signal-cli/signal-cli-jre:latest --config /var/lib/signal-cli'
# First, run the cli in link mode using podman
signal link -n dockercli
# Copy pairing link in the form of "sgnl://..."
# open separate shell and encode as QR code
qrencode -t utf8 "$PAIRING_LINK"
# scan qr code with signal app on your phone to complete pairing
# receive messages first upon pairing
signal receive -t 2
# Send yourself a message
YOUR_PHONE_NUMBER=""
signal send -m "Hello From Signal CLI" "$YOUR_PHONE_NUMBER"
- Get the App
- Subscripe to a Topic on your phone
- Using the hosted service:
# Think of a topic name that's unique enough so others won't guess
TOPIC="SREPATREDHAT"
# use curl to send a notification
curl -d 'Hello From Curl!' "https://ntfy.sh/${TOPIC}"
# Or, from stdin
echo "Hello from Stdin" | curl -d @- "https://ntfy.sh/${TOPIC}"
- Using self-hosted instance on local computer
# In new shell session, run the ntfy instance. Listen on all interfaces
podman run -p 0.0.0.0:8080:80 -it --rm --name ntfy binwiederhier/ntfy:latest serve
# Then, find out what your local ip in your network is, eg:
ip addr
- On your phone, subscribe to a new topic, Select "Use Another Server" and enter address
http://$YOURIP:8080
. Replace $YOURIP
with the local IP of your laptop. Also choose any topic name you like
- then, send notifications with curl as before, but using
localhost
instead of the public server
TOPIC="SREPATREDHAT"
curl -d 'Hello From Local Instance' "http://localhost:8080/${TOPIC}"
- Send notification when ocm cluster install is finished
# verbose way
TOPIC="SREPATREDHAT"
CLUSTER="<cluster name|cluster id>"
while true; do
cluster_state="$(ocm describe cluster $CLUSTER --json | jq -r '.state')"
if [[ $cluster_state != "installing" ]]; then
echo "Cluster not installing anymore: $cluster_state"
curl -d "Cluster is no longer Installing. State is: ${cluster_state}" "https://ntfy.sh/${TOPIC}"
break
fi
echo "Cluster still installing. Sleeping..."
sleep 5
done
# short version
while [[ $(ocm describe cluster $CLUSTER --json | jq -r '.state') == "installing" ]]; do
sleep 5
done
curl -d "Cluster is no longer Installing" "https://ntfy.sh/${TOPIC}"
- Ping when pod logs show a specific message
- Very simple implementation, every 20 Seconds, we check the logs of the last 40 seconds, to see if they contain the message we are looking for.
- if not, just sleep and repeat
- if found, stop looping and send the message
MESSAGE="Very Important Message I want to be pinged for"
PODNAME="important-pod-12345-asdffg"
NAMESPACE="openshift-important-stuff"
TOPIC="SREPATREDHAT"
while ! oc -n "$NAMESPACE" logs "$PODNAME" --since 40s | grep "$MESSAGE" ; do
sleep 20
done
curl -d "Pod $PODNAME said '$MESSAGE'" "https://ntfy.sh/${TOPIC}"
- Send msg when GH PR is approved
PR_ID="ID of the GH PR"
TOPIC="SREPATREDHAT"
while ! gh pr view $PR_ID --json labels -q '.labels | .[] | .name' | grep "approved"; do
sleep 60
done
curl -d "PR $PR_ID has been approved" "https://ntfy.sh/${TOPIC}"