Skip to content

Instantly share code, notes, and snippets.

@tomisacat
Forked from hazcod/notify-tm-backup
Created February 10, 2017 08:37
Show Gist options
  • Save tomisacat/9bdfa2ca36b2ae685f31d581317077e7 to your computer and use it in GitHub Desktop.
Save tomisacat/9bdfa2ca36b2ae685f31d581317077e7 to your computer and use it in GitHub Desktop.
Show a notification when Time Machine backup completes
# Raw command
BACKUP=$(tmutil latestbackup) ; if [ "$(cat ~/.lastbackup 2>/dev/null)" != "$BACKUP" ]; then echo $BACKUP > ~/.lastbackup ; osascript -e "display notification \"$(echo $BACKUP | xargs basename)\" with title \"Backup finished\""; fi
# As cron entry
*/5 * * * * BACKUP=$(tmutil latestbackup 2>/dev/null) ; if [ "$(cat ~/.lastbackup 2>/dev/null)" != "$BACKUP" ]; then echo $BACKUP > ~/.lastbackup ; osascript -e "display notification \"$(echo $BACKUP | xargs basename)\" with title \"Backup finished\""; fi 2>&1 >/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment