The OSX launchd system is vastly more powerful and integrated than crontab. Here is how to run an Applescript at arbitrary increments. It is somewhat tricky to set up, so here is the detailed solution for those who are transitioning away from the UNIX cron system.
Related pages: PageName
Make a file at path:
/Library/LaunchDaemons/Autorun.plist
containing UNIX style text like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <false/> <key>Label</key> <string>Autorun</string> <key>ProgramArguments</key> <array> <string>open</string> <string>/Users/Rachel/Library/Scripts/Autorun.app</string> </array> <key>StartInterval</key> <integer>22200</integer> </dict> </plist>
The Applescript is located at
/Users/Rachel/Library/Scripts/Autorun.app
and it is saved as an application.
This job launches the Applescript every 6 hours and 10 minutes (22,200 seconds), starting that increment after the file was loaded.
Load the file with this command:
sudo launchctl load /Library/LaunchDaemons/Autorun.plist
Verify the job is loaded:
sudo launchctl list
Unload the file with this command:
sudo launchctl unload /Library/LaunchDaemons/Autorun.plist
You can adjust a lot of options for individual jobs, but this is working for me now.
For troubleshooting, take a look at
open /private/var/log/system.log
196 page views.