Unix cron & iCal

Here’s a little ditty I slapped together today as a test.

If you keep iCal’s icon in your dock (OS X) the date on the icon is always wrong until you launch iCal. So, I wrote a simple script to launch iCal

tell application "iCal"
activate
quit
end tell

and saved it in my applications folder as dockiCal.app

Then I added this line to the end of my /etc/crontab file

0     0       *       *       *       root    cd /Applications/ ; open ./dockiCal.app

Which sets a cron job to launch iCal at midnight every night, which should update the date on the iCal icon in the dock. I’ll let you all know if works after a couple of days.
PS: You’ll need to keep your hard drive awake at midnight, as cron jobs won’t activate on a sleeping drive.

Interesting! I didn’t realize that the current date was retained after a launch.

I recently purchased a handy utility/preference pane called iBeeZz that will wake and sleep a Mac at scheduled times. It can also launch stuff when it wakes, including scripts. It allows me to run my Retrospect backups and cron jobs during the night, which is the ideal time for them to run. I use only the wake option and let the Energy Saver put the computer back to sleep.

http://ibeezz.reboute.net/en/

It defaults to July 17th. if you log out or restart. So I put the dockiCal.app in my Login Items via the pref pane.
I have a screen remnant problem when my box spins the drive down. It leaves blochy pixels all over the place. I think it’s due to my Radeon 8500 card that I bought on the cheap (ebay). The only fix is a reboot, so I rarely spin the drive down.