Last active
January 15, 2022 13:56
-
-
Save Wartz/76a78b8713c4fd0f0eceddbfc1bdcfe0 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
enabled=`/usr/bin/defaults read /Library/Preferences/com.apple.TimeMachine AutoBackup` | |
if [ "$enabled" == "1" ];then | |
lastBackupTimestamp=`date -j -f "%a %b %d %T %Z %Y" "$(/usr/libexec/PlistBuddy -c "Print Destinations:0:SnapshotDates" /Library/Preferences/com.apple.TimeMachine.plist | tail -n 2 | head -n 1 | awk '{$1=$1};1')" "+%Y-%m-%d %H:%M:%S"` | |
echo "$lastBackupTimestamp" | |
else | |
echo "<result>Disabled</result>" | |
fi | |
echo "$lastBackupTimestamp" > ~/Desktop/tmDate.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment