Part 3 of the Linux Newbie Administrator Guide
3.3.2 How do I execute a command at specified time (using "at" or "batch")?
(continued after the ads...)
In the example above, I entered the first line "at 7:00" on the command line and then pressed ENTER. To this, the at command displayed a prompt "at>". At this prompt, I entered my command "cdplay" and then pressed the control key and "d" simultaneously to finish the input. If instead of pressing
You can list the job you scheduled for execution using:
which will give you the numbered list of the jobs waiting.
If you changed your mind, you can remove a job from this list. For example:
will remove the job with the number eight on the list.
I could also schedule a job for execution much later, for example:
at 23:55 12/31/00
would start my X-windowing system right on time for the new millennium (5 minutes before midnight on 31 of December 2000).
If you cannot execute the at command, check if the at daemon ("atd") is loaded (as root, use ntsysv). If you cannot execute the at command as a regular user although it works for root, check if the empty file /etc/at.deny exists and there is no file /etc/at.allow. This should be the default setup and it permits all the users to execute at. If you want only certain users to use at, create a file /etc/at.allow and list these users there.
For other options, check:
If you wish to perform a processor-intensive job in the background when the system load is low, you may choose to use the batch command. For example, I could run setiathome (a program crunching data to help in search of extraterrestrial intelligence, SETI) using:
In this example, I entered the command batch and then, at the "at>" prompt, I entered the command which I wanted to be executed in the background. The job tries to start immediately, but goes ahead only when the system load is under 0.8 You can check the system load by inspecting the contents of the (virtual) file /proc/loadavg . For example:
When a batch job finishes, the output is sent to me via e-mail.
Next > 3.3.3 How do I set up cron?