Archive for September, 2008

OS X Cron Coolness

I just found out today that my webhosting provider, Dreamhost, is now officially adding 50GB of storage to each hosting account to be used as offsite backup for free (well, technically included with the cost of hosting)!

I figured that was a sign that I should get off my butt and setup a cron job that would tar/gz files on my home server (where the important stuff resides) and send it over to my Dreamhost acct on a monthly basis.

Cruising through the OS X cron man page, I saw this little gem:

Instead of the first five fields, one of eight special strings may appear:

           string          meaning
           ------          -------------------------
           @reboot         Run once, at startup.
           @yearly         Run once a year, "0 0 1 1 *".
           @annually       (same as @yearly)
           @monthly        Run once a month, "0 0 1 * *".
           @weekly         Run once a week, "0 0 * * 0".
           @daily          Run once a day, "0 0 * * *".
           @midnight       (same as @daily)
           @hourly         Run once an hour, "0 * * * *".

So my cron command ends up looking (mostly) like the following:

@monthly $HOME/scripts/

How easy is that? I know that most modern linux distros have /etc/cron.monthly, /etc/cron.daily, etc…but the OS X way just seemed really nice.

Anyone know if this exact same shorthand is available on other systems?