Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

its

macrumors newbie
Original poster
Jan 13, 2009
19
0
Hey guys

so my geektool broke in sierra which i got from the net which shows when the last time time machine had run.. The code is

Code:
#!/bin/sh

lastbackupdate=$(grep "Backup completed" /var/log/system.log | tail -n 1 | awk '{print $1" "$2" "$3}')

if [ "$lastbackupdate" = "" ] ; then
echo "There has never been a successful backup!"
echo
exit 0
else
date -j -f "%b %d %T" "$lastbackupdate" "+Last successful backup was %a, %b %d %Y, at %r"
echo
fi

syslog -F '$Time $Message' -k Sender com.apple.backupd -k Time ge -72h | tail -n 10

Couple of things to confirm and broken.. Since the log is not stored there so I guess I need to change the first line.. correct?

Code:
lastbackupdate=$(log show --style syslog  --predicate 'senderImagePath contains[cd] "TimeMachine"' --info | grep "Backup completed" | tail -n 1 | awk '{print $1" "$2}')

But the date format which comes out of it is

2016-09-27 17:11:57.958347+0900

This is not working with the

Code:
date -j -f "%b %d %T" "$lastbackupdate" "+Last successful backup was %a, %b %d %Y, at %r"

Error

Failed conversion of ``2016-09-27 17:11:57.958347+0900'' using format ``%b %d %T''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

What is the fix for this?

Also what will be the replacement for
Code:
syslog -F '$Time $Message' -k Sender com.apple.backupd -k Time ge -72h | tail -n 10

Would it be

Code:
og stream --style syslog  --predicate 'senderImagePath contains[cd] "TimeMachine"' --info | tail -n 10

Or any better to do all this?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.