-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup-backupd
executable file
·21 lines (19 loc) · 982 Bytes
/
backup-backupd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
## Show any recent successful backups.
## Then show the oldest and newest snapshows on your backup drive.
machine_name="`/usr/sbin/system_profiler SPSoftwareDataType | /usr/bin/grep 'Computer Name' | /usr/bin/awk '{print $3}'`";
echo "Time Machine for $HOSTNAME";
echo "============================================="
# Are we running an OS that contains the log command? If so, use it
if /usr/bin/which log | grep -q '/usr/bin/log'; then
/usr/bin/log show --predicate 'subsystem == "com.apple.TimeMachine"' --last 24h --style syslog --info | /usr/bin/grep -E '(successful)' | /usr/bin/tail -5
else
/usr/bin/grep 'Backup completed successfully' /var/log/system.log | /usr/bin/tail -5
fi
echo "";
echo "Earlist and Latest Backups"
echo "============================================="
/bin/ls /Volumes/*/Backups.backupdb/$machine_name/ | /usr/bin/head -n 2
/bin/ls /Volumes/*/Backups.backupdb/$machine_name/ | /usr/bin/grep -v Latest | /usr/bin/tail -n 2
echo;
exit 0;