maybe you have a bunch of daily rsnapshot cronjob backups and you’d like to know when they last ran. you can check the directory for the daily directory’s last modification time like this:
#!/bin/bash BACKUPLIST=("/mnt/backup1/site1.example.com" "/mnt/backup1/site2.example.com") for BACKUP in ${BACKUPLIST[@]} do echo -ne "Checking $BACKUP: " cd $BACKUP CHECKCOMMAND=`find . -maxdepth 1 -mtime -2 -printf "%TY-%Tm-%Td %TT\n"` if [[ "$CHECKCOMMAND" == "" ]]; then echo -ne "\t ERROR: NO BACKUP found for yesterday! " MOSTRECENT=`ls -alht $BACKUP|head -n 3|tail -1|awk '{print $6 " " $7 " " $8}'` echo "most recent: $MOSTRECENT" else echo -e "\t okay" fi done