The at command is your willing and punctual servant for odd jobs, reminders and one-offs. A more footloose sibling of steadfast cron, at is used to schedule a task to run once at a given time. Then all is forgotten.
The following examples and file paths are true for Red Hat Linux, and more or less true for other flavors of linux/unix.
The at daemon, /usr/sbin/atd, runs jobs queued via the at command. There is really no configuration for this daemon, but access control can be effected with the files /etc/at.allow and /etc/at.deny, which are simply lists of local user names. If at.allow exists, only users listed in it will be allowed to use at. If at.allow does not exist, at.deny will be checked.
If I list the user usr-3 in at.deny, it results in:
[usr-3@srv-4 usr-3]$ at 9 PM today You do not have permission to use at.
The at daemon does not need to be restarted for this to take effect.
Using at is really just a matter of remembering the date and time syntax. It is flexible enough to be both confusing and forgiving. The most important thing is to remember that the time of day must precede the date like so:
at 13:00 today
at 1 PM today
at noon tomorrow
at 23:00 19.03.01
at 11 PM March 19
at 05:00 03/19/01
at teatime 031901
Teatime is at 16:00 sharp.
You can also say:
at 5 PM + 2 weeks
at now + 3 [minutes, hours, days, weeks]
Feed at a single command:
[usr-3@srv-4 usr-3]$ at 9 PM today warning: commands will be executed using /bin/sh at> mail usr-3 -s "don't forget blah" < /home/usr-3/message.text at>EOT (end with Control-D) job 2 at 2001-04-16 21:00
or a series of commands
[usr-3@srv-4 usr-3]$ at 9 PM today warning: commands will be executed using /bin/sh at> date > /home/usr-3/foo at> w >> /home/usr-3/foo at> mail -s "9 PM logged in users" < /home/usr-3/foo at> job 3 at 2001-04-16 21:00
You can also feed at a file which makes it possible to script at jobs to run other scripts.
at 15:37 today < /home/usr-3/job
To list the at jobs in the queue run atq, and use atrm to remove jobs from the queue. Jobs are queued in /var/spool/at.
[usr-3@srv-4 usr-3]$ atq 2 2001-04-16 21:00 a usr-3 3 2001-04-16 21:00 a usr-3 [usr-3@srv-4 usr-3]$ atrm 2 [usr-3@srv-4 usr-3]$ atq 3 2001-04-16 21:00 a usr-3 [root@srv-4 at]# ls -al total 8 drwx------ 3 daemon daemon 1024 Apr 16 20:49 . drwxr-xr-x 11 root root 1024 Jan 16 16:21 .. -rw------- 1 daemon daemon 6 Apr 16 20:49 .SEQ -rwx------ 1 usr-3 usr-3 1784 Apr 16 20:37 a0000300fb2110 -rwx------ 1 root root 1738 Apr 16 20:50 a0000400fb2110 drwx------ 2 daemon daemon 1024 Mar 18 13:10 spool
Let our punctual little friend at help you be two places at once.