Linux and Unix at command
Quick links
About at
Syntax
Examples
Related commands
Linux and Unix main page
Schedules a command to be ran at a particular time, such as a print job late at night.
| at | executes commands at a specified time. |
| atq | lists the user's pending jobs, unless the user is the superuser; in that case, everybody's jobs are listed. The format of the output lines (one for each job) is: Job number, date, hour, job class. |
| atrm | deletes jobs, identified by their job number. |
| batch | executes commands when system load levels permit; in other words, when the load average drops below 1.5, or the value specified in the invocation of atrun. |
at [-c | -k | -s] [-f filename] [-q queuename] [-m] -t time [date] [-l] [-r]
| -c | C shell. csh(1) is used to execute the at-job. |
| -k | Korn shell. ksh(1) is used to execute the at-job. |
| -s | Bourne shell. sh(1) is used to execute the at-job. |
| -f filename | Specifies the file that contains the command to run. |
| -m | Sends mail once the command has been run. |
| -t time | Specifies at what time you want the command to be ran. Format hh:mm. am / pm indication can also follow the time otherwise a 24-hour clock
is used. A timezone name of GMT, UCT or ZULU (case insensitive) can follow to specify that the time is in Coordinated Universal Time. Other
timezones can be specified using the TZ environment variable. The below quick times can also be entered: midnight - Indicates the time 12:00 am (00:00). noon - Indicates the time 12:00 pm. now - Indicates the current day and time. Invoking at - now will submit submit an at-job for potentially immediate execution. |
| date | Specifies the date you wish it to be ran on. Format month, date, year. The following quick days can also be entered: today - Indicates the current day. tomorrow - Indicates the day following the current day. |
| -l | Lists the commands that have been set to run. |
| -r | Cancels the command that you have set in the past. |
at -m 01:35 < atjob
Run the commands listed in the 'atjob' file at 1:35AM, in addition all output that is generated from job mail to the user running the task. When this command has been successfully enter you should receive a prompt similar to the below example.
commands will be executed using /bin/csh
job 1072250520.a at Wed Dec 24 00:22:00 2003
at -l
This command will list each of the scheduled jobs as seen below.
1072250520.a Wed Dec 24 00:22:00 2003
at -r 1072250520.a
Deletes the job just created.
atrm 23
Deletes job 23.
If you wish to create a job that is repeated you could modify the file that executes the commands with another command that recreates the job or better yet use the crontab command.
Note: Performing just the at command at the prompt will give you an error "Garbled Time", this is a standard error message if no switch or time setting is given.
