Skip to content

Instantly share code, notes, and snippets.

@hazcod
Last active December 23, 2019 09:25
Show Gist options
  • Save hazcod/1accf6c356afb2094dec42c6d040f864 to your computer and use it in GitHub Desktop.
Save hazcod/1accf6c356afb2094dec42c6d040f864 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