Package Update Push Notification Using ntfy.sh
Hey!
The following code can be used for you to receive a notification of upgrades available on your debian-based server. Just change the NTFY_ENDPOINT accordingly and set the script to run on a daily basis as a cronjob.
#!/bin/bash
NTFY_ENDPOINT="https://ntfy.sh/<your secret endpoint goes here>"
TITLE="Updates for $(hostname)"
# Get updates
apt update &> /dev/null
# Get the list of upgradeable components
UPGRADABLE=$(apt list --upgradeable | wc -l)
if (( $UPGRADABLE > 1 ))
then
curl -H "t: ${TITLE}" -d "There are ${UPGRADABLE} upgrades pending." $NTFY_ENDPOINT
fi
Have fun!!