Skip to content

Instantly share code, notes, and snippets.

@adamlazz
Created January 24, 2014 21:19
Show Gist options
  • Save adamlazz/8606705 to your computer and use it in GitHub Desktop.
Save adamlazz/8606705 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