Skip to content

Instantly share code, notes, and snippets.

@AilisObrian
Forked from adamlazz/tm-pushover.sh
Created January 6, 2017 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AilisObrian/27e4fb104f2be4f8ce0247412d739bc5 to your computer and use it in GitHub Desktop.
Save AilisObrian/27e4fb104f2be4f8ce0247412d739bc5 to your computer and use it in GitHub Desktop.
Time Machine backup completion notifications using Pushover
#!/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