Use the 'at' command to schedule tasks

Sep 26, '05 06:00:00AM

Contributed by: m_herbison

Tiger only hintI don't know if this is new to people, but I just discovered that the *NIX at command finally works in OS X Tiger. I know that I've tried getting it to work since 10.0, with no luck (but maybe I missed it in 10.3).

For those of you unfamiliar with it, at allows you to run command line tasks at a specified date and time. I first used it when I was teaching, and wanted to post exam answers at a specified time (after the exam was given). I could put the answer-key html file on the website the day before I wanted it viewable, but set the chmod to disallow access. Then I would issue the command:

$ at 3:30pm tomorrow [hit return]
chmod +r exam1key.html [hit return]
[hit Control-D]
I've found this command to be very useful in scheduling one-off kinds of events, like running a job late at night or even setting reminders.

If you look at the man page (man at), it tells you that this is turned off by default, but you can enable it with this command:
$ sudo launchctl load -w /System/Library/LaunchDaemons/
I am pretty sure you have to reboot the machine for it to kick in. I highly recommend checking out the man page, since you'll see how straightforward this tool is. Ff you aren't familiar with these other useful command line tools, also check out nice (and renice) and nohup.

[robg adds: There's a much older hint that covers using at in OS X 10.2 (and maybe 10.1; the hint was posted the day 10.2 was released). However, since the activation method has changed with Tiger, I felt it worth posting this revised version.]

Comments (6)

Mac OS X Hints