Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create SuperDuper! backup reminders using Growl and cron Apps
I use a couple of shell scripts that use Growl to remind me to run SuperDuper backups. The first script (backupcompleted) is set to run after each SuperDuper backup. It writes a timestamp into an invisible file called .lastbackup in my home directory; here's the script:
#!/bin/bash
# This script is run by SuperDuper each time a backup is completed.
date "+%s" > ~/.lastbackup
The second script (lastbackup) reads the .lastbackup file and calculates the time elapsed. It takes one argument: the desired number of hours to wait before showing an alert.

If the elapsed time is greater than the time suppled to the script, it shows a Growl notification. If the elapsed time is greater than twice the time suppled to the script, it also increases the priority of the alert (so you can set a diferent colour for it in Growl preferences). Here's the script:
#!/bin/bash

USAGE="Usage: $0 [integer number of hours]"

if [[ ! "$#" == 1 ]]
then 
  echo $USAGE
  exit 1
fi

let "DISPLAYTHRESHOLD = $1 * 60 * 60" # Convert to seconds
LASTBACKUP=`cat ~/.lastbackup`
NOW=`date "+%s"`
let "ELAPSEDTIME = $NOW - $LASTBACKUP"

if (( $ELAPSEDTIME > $DISPLAYTHRESHOLD ))
then
  
  let "OMFG = $DISPLAYTHRESHOLD * 2"
  
  if (( $ELAPSEDTIME > $OMFG ))
  then
    PRIORITY="2"
  else
    PRIORITY="0"
  fi
  
  NICEDATE=`date -r $LASTBACKUP "+%e %B at %k:%M"` # Format date nicely
  MESSAGE="Your last full backup was completed on $NICEDATE."
  
  /usr/local/bin/growlnotify -s -n "Backup Check" -a SuperDuper\! -t "Last Backup" -m  "$MESSAGE" -p "$PRIORITY"
fi
Finally, to make the script run hourly add this line to your crontab:
0 * * * * /full/path/to/lastbackup 24 &>/dev/null
[robg adds: I haven't tested this one.]
    •    
  • Currently 2.30 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (10 votes cast)
 
[7,980 views]  

Create SuperDuper! backup reminders using Growl and cron | 7 comments | Create New Account
Click here to return to the 'Create SuperDuper! backup reminders using Growl and cron' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create SuperDuper! backup reminders using Growl and cron
Authored by: gbrandt on Mar 08, '10 08:32:42AM

Why not just let superduper automate your backups?



[ Reply to This | # ]
Create SuperDuper! backup reminders using Growl and cron
Authored by: leamanc on Mar 08, '10 09:41:33AM
Indeed, and let me pipe in with the requisite complaining about cron over launchd.

In fact, if you are going to just ignore SuperDuper's automation capabilities and write some scripts, launchd can handle the whole enchilada for you--watching for changed files or folders and then scheduling a scripted task.

[ Reply to This | # ]

Create SuperDuper! backup reminders using Growl and cron
Authored by: Tom_H on Mar 08, '10 02:02:10PM

Both valid points. I wrote these scripts because my laptop is rarely connected to my backup drive. I wanted to remind myself that I should be backing up regularly, but only if I'm not.

If someone could tell me how to get superduper to remind me that I've missed a backup without launching and complaining that my backup drive isn't connected I'd agree that this tip is quite pointless.



[ Reply to This | # ]
Create SuperDuper! backup reminders using Growl and cron
Authored by: FJModrego on Mar 09, '10 03:40:02AM

This a function I too would like to see implemented in SuperDuper ! I don't have the backup drive permanently switched on and a reminder would be very useful...



[ Reply to This | # ]
Create SuperDuper! backup reminders using Growl and cron
Authored by: slb on Mar 08, '10 04:03:06PM

Not only that, but honestly, as busy as I can get at times, I don't forget this.
Oh well, as with all hints, some like 'em, some don't :)



[ Reply to This | # ]
Create SuperDuper! backup reminders using Growl and cron
Authored by: kevans on Mar 08, '10 04:12:22PM

I can't see the point of this (unless you just like to write scripts). I've been using SuperDuper for several years, and I have three automated backups: daily user data, weekly user data, and a monthly bootable disk clone. I can understand that you might want to know if backups are running when scheduled. In that case, don't tell SD (in prefs) to close when finished, and the next time you see your screen, the SD window will be open and will confirm that all went well.



[ Reply to This | # ]
Create SuperDuper! backup reminders using Growl and cron
Authored by: coachbb94 on Mar 10, '10 06:20:04AM

kevans, the author stated "I wrote these scripts because my laptop is rarely connected to my backup drive".



[ Reply to This | # ]