Jan 122014
 

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:

ExampleMeaning
at noon 12:00 PM September 18, 2001
at midnight 12:00 AM September 19, 2001
at teatime 4:00 PM September 18, 2001
at noon tomorrow 12:00 PM September 19, 2001
at next week 10:00 AM September 25, 2001
at next monday 10:00 AM September 24, 2001
at fri 10:00 AM September 21, 2001
at OCT 10:00 AM October 18, 2001
at 9:00 AM 9:00 AM September 19, 2001
at 2:30 PM 2:30 PM September 18, 2001
at 1430 2:30 PM September 18, 2001
at 2:30 PM tomorrow 2:30 PM September 19, 2001
at 2:30 PM next month 2:30 PM October 18, 2001
at 2:30 PM Fri 2:30 PM September 21, 2001
at 2:30 PM 9/21 2:30 PM September 21, 2001
at 2:30 PM Sept 21 2:30 PM September 21, 2001
at 2:30 PM 9/21/2010 2:30 PM September 21, 2010
at 2:30 PM 21.9.10 2:30 PM September 21, 2010
at now + 30 minutes 10:30 AM September 18, 2001
at now + 1 hour 11:00 AM September 18, 2001
at now + 2 days 10:00 AM September 20, 2001
at 4 PM + 2 days 4:00 PM September 20, 2001
at now + 3 weeks 10:00 AM October 9, 2001
at now + 4 months 10:00 AM January 18, 2002
at now + 5 years 10:00 AM September 18, 2007

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.

 Posted by at 12:48 pm

Sorry, the comment form is closed at this time.