#!/opt/local/bin/perl -w # Get the last backup time we have, with no newline $last_backup = `/usr/bin/syslog -T sec -F '\$Time - \$Sender -\$Message' | grep backupd | grep 'Backup completed' | tail -1`; chomp($last_backup); # Make sure it exists - exit if not if ($last_backup eq "") { die "No information on the last backup was found.\n"; } # Get the unix timestamp out of the last message ($backup_stamp, undef, undef) = split('-', $last_backup); # See if the server exists $remotehost = "slartibartfast.h3cinc.com"; `ping -c 3 $remotehost > /dev/null 2>& 1`; if ($? != 0) { die "$remotehost unreachable!\n"; } # Send the information to the server $remoteport = 122; `ssh -p $remoteport $remotehost "echo $backup_stamp > /raid/backups/ibiza/time-machine-stamp"`;