Skip to main content
Question

Retrospect EA - Last Backup Completed

  • December 15, 2015
  • 4 replies
  • 24 views

burdett
Forum|alt.badge.img+7

Hi,
Anyone managing Mac clients being backed up by Retrospect? I need a Extension Attribute to report the last date a client was backed up.

I found a logfile /private/var/log/retroclient.log with the backup date and time. Here is an example of the log file entry;
1450142118: SopsSetBackupDates: last:2015-12-14@17:0 next:2015-12-15@17:0

I made an attempt at the following script but didn't quite get the results I wanted. The result was, result>last:2015-12-14@17:0</result I just want the date, 2015-12-14.

#!/bin/sh
if [ -f /private/var/log/retroclient.log ];then
lastBackupTime=`cat /private/var/log/retroclient.log | grep -w "SopsSetBackupDates: last" | awk '{print $3}'`
echo "<result>$lastBackupTime</result>"
else
echo "<result></result>"
fi

4 replies

davidacland
Forum|alt.badge.img+18
  • Valued Contributor
  • December 15, 2015

You could use sed to remove characters after and including the @ or perhaps just use cut if the date value length stays the same when the days and months are single digits.


Forum|alt.badge.img+15
  • Contributor
  • December 15, 2015

A fun awk parameter is -F which allows you to specify the delimiter (what separates fields). By default its a space, but you add this to the end of your line...

|awk -F@ '{print $1}'

Forum|alt.badge.img+12
  • Contributor
  • December 15, 2015

People are still using Retrospect? I haven't heard of that in a very long time!


burdett
Forum|alt.badge.img+7
  • Author
  • Valued Contributor
  • April 14, 2016

Incase anyone was interested the final version of this script, I ended up using the following;

#!/bin/sh
if [ -f /private/var/log/retroclient.log ];then
lastBackupTime=`tail -r /private/var/log/retroclient.log | grep -m 1 "SopsSetBackupDates" | awk '{print $2, $3}'| awk -F@ '{print $1}' | sed 's/.*://g'`
echo "<result>$lastBackupTime</result>"
else
echo "<result></result>"
fi