Cron? Launchd? iCal??
If so, how?
|
feedback
|
This question came from our site for professional and enthusiast programmers.
|
For reference, all 3 options would work. The iCal option however has more limitations than the others. (There are GUIs for editing cron and launchd as mentioned in other answers) Cron is the most straight forward and well known and there are many tutorials available. The Coles Notes is to add the last line from below to your crontab (either by editing
In Mac OS X, If you want to use A sample run daily launchd plist (be sure the file and and the label are the same - minus the plist for the label) follows - this script is run everyday at 3 minutes past midnight:
It's also worth noting that launchd tasks if they were scheduled for when the computer is asleep or off, they will run when the computer becomes available again (turning it on or waking it up) - though only once no matter how many days it may have been. Edit: I just was at an Apple document that said that if the machine is off, then you will lose any launch events during that time, (your script will not launch on startup), (sleep does launch script on waking up) Another option is to use "at" (check manual page with "man at"). The script can reschedule itself with e.g.:
(use "+ 10 minutes" instead of "tomorrow" to run it every 10 minutes; to stop scheduling, just do "at -l" to list the scheduled job ids and then "at -r id" to remove the job) You may have to start the corresponding daemon (atrun) first with (see http://superuser.com/a/43680):
Advantages: quick fix, no sudo/root access needed, easy to do complicated schedule patterns Disadvantage: not standard scheduling method for OS X (which is launchd) | |||||||||
feedback
|
It depends on what you want: iCal scripts will only be executed if you are logged in, | |||
|
feedback
|
|
CronniX is a nice GUI frontend for scheduling cron jobs on the mac... Pretty decent if you don't want to go and delve into the cron documentation. | |||
|
feedback
|
|
I always use Lingon for this, but it looks like it's out of development. You could try Crontooie, but I've never used it personally. Or just edit the crontab file in the terminal. | |||
|
feedback
|
|
There's also this neat thing called AppleScript. | |||
feedback
|
...whatever command-lines you throw in for "....cut...." will get run every five minutes. 30 years of progress, and 'cron' is still my favorite scheduler. -C | |||
|
feedback
|
|
Here’s Apple’s guide to the nitty-gritty of writing launchd preference files: | ||||
|
feedback
|