1

I know i can get the time stamp of the latest Time Machine backup with the command tmutil latestbackup | grep -E -o "[0-9\-]+$" but this only works when my backup disk is plugged in. If not, i get the error message Unable to locate machine directory for host.

Is there any other way to figure out (through scripting) when the last backup was made?

I'm running OS X Mavericks and the use case would be to eventually run this as remote monitoring for Macs, say, using collectd.

  • 2
    This might be of some use: defaults read /Library/Preferences/com.apple.TimeMachine.plist Destinations | grep "BACKUP_COMPLETED_DATE" – user3439894 Sep 28 '15 at 10:23
1

Parse the XML you get from settings - defaults read on the command line:

defaults read /Library/Preferences/com.apple.TimeMachine.plist Destinations | tail -4 |head -1

That is a crude way to parse the xml / plist so you could use python or swift to properly read the preference plist / xml and parse out things like the last local snapshot date, last consistency check date, etc...

defaults read /Library/Preferences/com.apple.TimeMachine.plist Destinations

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .