cron is deprecated in OS X. iCal makes a straightforward, if tedious, replacement, despite its limited support for scripted alarms.
In iCal you can easily create a repeating event with an associated alarm that runs a script.
Put all of your periodic system management events into a hidden "Automation" calendar (so they don't clutter up the calendar view) and you're all set.
Of course, there's a problem. I prefer to write system management scripts using Python. iCal can run only AppleScripts.
It's easy to write an AppleScript "wrapper" which just launches a shell script, but the process involves lots of button-clicking:
- Launch Script Editor
do shell script "/path/to/shell/script"
- Save the script
- Quit Script Editor
Given the path to a shell script, the following Python program creates a corresponding AppleScript wrapper in the same directory:
#!/usr/bin/env python import sys, os, subprocess, logging def main(): for filename in sys.argv[1:]: pathname = os.path.abspath(filename) scriptname = os.path.splitext(pathname) + ".scpt" if os.path.exists(scriptname): os.remove(scriptname) status = subprocess.call([ "osacompile", "-e", 'do shell script "%s"' % pathname, "-o", scriptname]) if status: logging.error("Got status %d creating %s" % (status, scriptname)) if name == "main": main()