I would like to schedule a task to execute with parameters at a specific time/date in the future.
Does OS X include any such tool (even if it's command-line)? If not, are there any free or relatively cheap tools out there to accomplish this?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Commands to be run via
launchd are described in Apple "plists", or property lists, which are really just XML files:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple. com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.apple.periodic-daily</string> <key>ProgramArguments</key> <array> <string>/usr/sbin/periodic</string> <string>daily</string> </array> <key>LowPriorityIO</key> <true/> <key>Nice</key> <integer>1</integer> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>3</integer> <key>Minute</key> <integer>15</integer> </dict> </dict> </plist>
Having said that, it's not a very user friendly (nor Mac-like) way of scheduling commands to be run. This question on SuperUser lists a few GUI alternatives, including:
launchd Editor ($5 Shareware)
There are two Unix command-line tools that do what you want.
at will allow you to schedule a task to execute once at a specific time in the future. Of course, part of the task could be to schedule another task.
cron allows you to schedule tasks to regularly execute at the same time, based on time of day, day of the week, etc.
One thing to note is that both of these will not run tasks if your machine is not running at the time they are scheduled. There are alternatives, such as anacron, that will run scheduled tasks the next time the machine boots.
iCal can be used to run AppleScripts, launch applications, and perform tasks to a schedule.
There are limitations to using iCal, but it is included with Mac OS X and relatively easy to set up. The limitations and a visual walk through on how to set up a scheduled AppleScript are included in the link above.