Last active
August 29, 2015 14:25
-
-
Save yene/76f5b1673682be6a120b to your computer and use it in GitHub Desktop.
Check when the last Time Machine Backup was and display notification
This file contains 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
// use it in calender: http://apple.stackexchange.com/a/59265/14030 | |
app = Application.currentApplication() | |
app.includeStandardAdditions = true | |
ObjC.import('Cocoa') | |
dict = $.NSDictionary.dictionaryWithContentsOfFile('/Library/Preferences/com.apple.TimeMachine.plist') | |
firstItem = dict.valueForKey('Destinations').firstObject | |
lastBackup = firstItem.valueForKey('SnapshotDates').lastObject | |
diff = lastBackup.timeIntervalSinceNow // in seconds | |
diff = (diff * -1) | |
if (diff > 60*60*24*3) { | |
app.displayNotification('Last Backup is more than 3 days old.' ) //, {withTitle: 'BACKUP'} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment