-
-
Save AilisObrian/27e4fb104f2be4f8ce0247412d739bc5 to your computer and use it in GitHub Desktop.
Time Machine backup completion notifications using Pushover
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
running(){ | |
tmutil status | grep "Running" | awk '{print $3}' | cut -c 1 | |
} | |
notify() { | |
DATE=`date` | |
curl -s \ | |
-F "token=<use your own>" \ | |
-F "user=<use your own>" \ | |
-F "title=Time Machine backup finished" \ | |
-F "message=$DATE" \ | |
https://api.pushover.net/1/messages.json > /dev/null | |
} | |
if [[ `running` == 1 && ! -e .tm-lock ]]; then | |
touch .tm-lock | |
while [[ `running` == 1 ]]; do | |
sleep 10 | |
done | |
notify | |
rm .tm-lock | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment