I have created the following simple backup script for my Ubuntu machine:
#!/bin/bash
set -e
echo "Mounting network share"
sudo mkdir -p /var/backup
sudo mount -t nfs 192.168.178.33:/volume1/backup_data /var/backup
echo "Creating backups"
rsync -av /volume1/ /var/backup --delete
echo "Unounting network share"
sudo umount /var/backup
set +e
This is executed via a cronjob every night and works quite well.
Now I would like to add some reporting (e.g. via Gotify). A success/failure notification would be very helpful. This is how I can send a Gotify notification:
curl "http://192.168.178.30:8080/message?token=XXXXXXXX" -F "title=my title" -F "message=my message"
What would be the best way to integrate this into the script? Is there some kind of global success/failure flag one could query?