Using at
The “at” command is used to
schedule a one-time task at a specific time.
Suppose
you would like your computer to rebuild your Linux kernel this evening while
you're at the pub. You might proceed like this:
$ at 20.30
warning: commands will be executed using
/bin/sh
at> cd /usr/src/linux
at> make all
at> <EOT>
job 2 at Wed Feb 14 19:30:00 2007
As
you'll see from this, at collects the commands you want to run from its
standard input, up to an EOT character (^D by default).
Your
list of queued jobs can be examined using atq:
$ atq
2 Wed Feb 14 19:30:00 2007 a chris
$
Controlling access “at”
/etc/at.deny
“at” utility command
atd – run jobs
queued for later execution
atq – list
queue
atrm – delete the job
atrun- run jobs queued for
later execution
The job run immediately
[root@server1 Desktop]# at now
at> uptime >>
/root/Desktop/test.txt
at>
job 4 at 2012-10-26 07:53
[root@server1 Desktop]# cat test.txt
07:54:09 up 1:24, 2
users, load average: 0.00, 0.00, 0.00
The job run 1 minutes lately current
time
[root@server1 Desktop]# at now + 1
minutes
at> uptime >
/root/Desktop/test.txt
at>
job 6 at 2012-10-26 07:59
[root@server1 Desktop]# atq
6
2012-10-26 07:59 a root
[root@server1 Desktop]# cat test.txt
07:57:00 up 1:27, 2
users, load average: 0.00, 0.00, 0.00
You can delete a job
from the queue using atrm:
$ atrm 2