The ‘at’ command

The “at” command lets you execute a command or script at a later time, you can set the time in many different ways and even have the result mailed to you after the command has been executed.

Here are some examples:

[table “1” not found /]

Other Commands and Options:

To see a list of pending at jobs (the ones that haven’t run yet), use the command “atq”. This will show the job number and date-time for that job.

To see the contents of some at job, use the command “at -c jobnum”. This shows the complete environment that gets set for the job as well; the actual commands of your job are at the bottom.

To delete an at job before it has run, use the command “atrm jobnum”.

An at job may be created in a particular queue, using the form “at -q queue date-time”. The queue is a single letter. The default queue is “a”. Queue “b” is reserved for batch jobs. Using higher lettered queues will run your at job with higher nice values.

To send a message to yourself, use:

echo “DISPLAY=$DISPLAY xmessage 4125597 232207 call @9am 1/13” | at 08:45 tomorrow

‘at’ allows fairly complex time specifications, extending the POSIX.2 standard. It accepts times of the form HH:MM to run a job at a specific time of day. (If that time is already past, the next day is assumed.)

You may also specify midnight, noon, or teatime (4pm) and you can have a time-of-day suffixed with AM or PM for running in the morning or the evening.

You can also say what day the job will be run, by giving a date in the form month-name day with an optional year, or giving a date of the form MMDDYY or MM/DD/YY or DD.MM.YY. The specification of a date must follow the specification of the time of day. You can also give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks and you can tell at to run the job today by suffixing the time with today and to run the job tomorrow by suffixing the time with tomorrow.

For example, to run a job at 4pm three days from now, you would do at 4pm + 3 days, to run a job at 10:00am on July 31, you would do at 10am Jul 31 and to run a job at 1am tomorrow, you would do at 1am tomorrow.

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....