CronniX: Fills a Hole in OS X
Monday, April 12, 2010 at 11:32AM
Joseph Kelley

One feature missing from "The world's most advanced operating system", is the ability to schedule tasks.  This is, admittedly, not something most users would notice since most software designed to run on a schedule like backups, e-mail retreival and the like come with the ability to schedule themselves.  Windows has included a task scheduler since Windows 95.  Most users don't even know this for the same reason.  For us hardcore geeks, a tool for running tasks on a schedule is something we don't need that often, but we need one nonetheless. That's why I was very surprised to learn OS X doesn't include a scheduling utility.  I've been a Mac guy for almost three years and it took until a week ago to make this discovery.  It's just not something I need that often.
This all came about because I couldn't keep a Western Digital MyBook external hard disk from going to sleep.  WD includes this "feature" to spin down their disks after ten minutes of non-use to save power.  The problem is, none of my Macs would wake the silly thing back up.  This caused all sorts of problems with OS X.  When the WD would go to sleep, my iMac would "beachball" for one or two minutes, completely locking up Finder.  This would make my machine almost unusable until Finder timed-out and displayed an error message about not being able to find the external drive.  The machine would also hang on a reboot until I unplugged the firewire cable from the drive.  After an hour on WD's support site and searching forums I discovered there was no official fix from WD but there was a workaround to keep the disk from sleeping.

This is where it gets geeky.  To keep the disk from going to sleep, you have to access the device once within a ten minute period.  There's a handy UNIX command, "touch", to access a file and change its modification date.  It looks like this:


touch /Volumes/MYBOOK/filename

Where "MYBOOK" is the name of the WD drive and "filename" is a file on that disk.  I tested this manually using Terminal and sure enough, it kept the drive from sleeping.  This is when I went looking for a way to schedule this simple command to run automatically.  There is a built-in UNIX process called cron used by OS X to schedule tasks at given intervals or at specific times.  To add tasks to this process, the crontab (short for cron table) needs to be edited.  Doing this requires making the transition from geek to full-blown nerd if you want to tackle it from the command line.  That's when I went looking for a GUI tool to do this and found CronniX.  (If you want to know how to edit crontab from the Terminal there's a good quick-n-dirty how-to here.)
While not nearly as user-friendly as Windows' Task Scheduler, Cronnix will get the job done if you understand just a little about crontab's format.  It's not hard to figure out and Cronnix is absolutely free.  It presents you with a straight-forward interface to execute a command on a schedule you configure.

I scheduled the above "touch" command to run every five minutes and now my WD external drive doesn't go to sleep.  Its a shame to have to do this, but like many hardware vendors, Western Digital doesn't do Macs very well.  Cronnix, while not elegant by any measure, gets the scheduling job done in OS X without turning you into a complete nerd.

Article originally appeared on Fighting the Left. TEXAS STYLE! (http://mactexan.com/).
See website for complete article licensing information.