Jump to content

Bash Script to automate Raspberry Pi updates and send a PushOver notification


FunkyBuddha

Recommended Posts

#!/bin/bash -x
sudo apt-get update && sudo apt-get -y upgrade  > /home/pi/pi_updt.log
upgdcnt=$(grep upgraded /home/pi/pi_updt.log | grep installed | sed -e 's/^\(.\{1\}\).*/\1/')
if [[ "$upgdcnt" == "0" ]]; then
        exit
fi
curl -s \
  --form-string "token=APP_TOKEN" \
  --form-string "user=USER_TOKEN" \
  --form-string "message=RASPBERRY-PI UPDATED" \
  https://api.pushover.net/1/messages.json

Link to comment

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...