From f29f992839c794df0e9b24f096cfc044a16228f0 Mon Sep 17 00:00:00 2001 From: Michael <30936296+mtan93@users.noreply.github.com> Date: Wed, 31 May 2023 17:49:46 +0100 Subject: [PATCH] Create tmbackupdate.sh --- tmbackupdate.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tmbackupdate.sh diff --git a/tmbackupdate.sh b/tmbackupdate.sh new file mode 100644 index 0000000..fd215a4 --- /dev/null +++ b/tmbackupdate.sh @@ -0,0 +1,9 @@ +#!/bin/sh +rm -f /tmp/TMBACKUPDATE.check +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 Last Backup": $lastBackupTimestamp" >> /tmp/TMBACKUPDATE.check +else +echo "Time Machine is Disabled" >> /tmp/TMBACKUPDATE.check +fi