All HowTo's

Schedule jobs with the AT command

You can schedule commands to run at a later time by using the ‘at’ command. Why use ‘at’ when you can use ‘cron’? Because ‘at’ is good for tasks that only need to run once.

To set a task (to email a log file at a later time) to run in one hour from now:

at now + 1 hour (Enter)
mail [email protected] < /var/log/messages (Enter)
(Control+D)

To see your queued tasks:

atq

You will get output like this:

333	2015-03-12 14:27 a root

In the above you can see there is one task labeled '333'. You can see the command set by issuing the command:

at -c 333

The above command will output plenty of details. The part you want is the second to last line.

You can remove a tasks by issuing the following:

atrm 333

Leave a Reply

Your email address will not be published. Required fields are marked *