Runs commands at a later time.
at [ -c | -k | -s | -q Queue ] [ -m ] [ -f File ] { -t Date |Time [ Day ] [ Increment ] }
at -l [ -o ] [ Job ... | -q Queue ]
at -n [ User ]
The at command reads from standard input the names of commands to be run at a later time and allows you to specify when the commands should be run.
The at command mails you all output from standard output and standard error for the scheduled commands, unless you redirect that output. It also writes the job number and the scheduled time to standard error.
When the at command is executed, it retains the current process environment. It does not retain open file descriptors, traps, and priority.
The /var/adm/cron/at.allow and /var/adm/cron/at.deny files control which users can use the at command. A person with root user authority can create, edit, or delete these files. Entries in these files are user login names with one name to a line. The following is an example of an at.allow file:
root nick dee sarah
If the at.allow file exists, only users whose login names appear in it can use the at command. A system administrator can explicitly stop a user from using the at command by listing the user's login name in the at.deny file. If only the at.deny file exists, any user whose name does not appear in the file can use the at command.
A user cannot use the at command if one of the following is true:
If the at.allow file does not exist and the at.deny file does not exist or is empty, only someone with root user authority can submit a job with the at command.
To schedule a job to run at a later time, you must specify a time to start the job. You may specify the time by using either the -t Date flag or the Time, Day, and Increment parameters.
The Date variable to the -t flag is specified using the following format:
The digits in the Date
variable are defined as follows:
Both the CC and YY digits are optional. If neither is given, the current year is assumed. If the YY digits are specified but the CC digits are not, the CC digits are defined as follows:
The resulting time is affected by the value of the TZ environment variable.
The Time parameter may be specified as a number followed by an optional suffix. The at command interprets one- and two-digit numbers as hours. It interprets four digits as hours and minutes. The T_FMT item in the LC_TIME locale category specifies the order of hours and minutes. The default order is the hour followed by the minute. You can also separate hours and minutes with a : (colon). The default order is Hour:Minute.
In addition, you may specify one of the following suffixes:
If you do not specify am or pm, the at command uses a 24-hour clock. These suffixes can follow the time as a separate argument or separated with spaces. The am and pm suffixes are defined values from the AM_STR and PM_STR items in the LC_TIME locale category. The suffix zulu indicates that the time is GMT (Greenwich Mean Time).
The at command also recognizes the following keywords as special values for the Time parameter:
You may specify the optional Day parameter as either a month name and a day number (and possibly a year number preceded by a comma), or a day of the week. The D_FMT item in the LC_TIME locale category specifies the order of the month and day (by default, month followed by day). The DAY_1 through DAY_7 items in the LC_TIME locale category specify long day names. The ABDAY_1 through ABDAY_7 items in the LC_TIME locale category specify short day names. The MON_1 through MON_12 items in the LC_TIME locale category specify long month names. The ABMON_1 through ABMON_12 items in the LC_TIME locale category specify short month names. By default, the long name is fully spelled out; the short name is abbreviated to two or more characters for weekdays, and three characters for months.
The at command recognizes today and tomorrow as special default values for the Day parameter. The today value is the default Day if the specified time is later than the current hour; the tomorrow value is the default if the time is earlier than the current hour. If the specified month is less than the current month (and a year is not given), next year is the default year.
-c | Requests that the csh command be used for executing this job. |
-f File | Uses the specified file as input rather than using standard input. |
-F | Suppresses delete verification. Use this flag with the -r flag. |
-i | Specifies interactive delete. Use this flag with the -r flag. |
-k | Requests that the ksh command be used for executing this job. |
-l | Reports your scheduled jobs. If you have root user authority, you can get jobs issued by other users. |
-m | Mails a message to the user about the successful execution of the command. |
-n [ User ] | Reports the number of files in your queue. If you have root user authority, you can get information about another user's queue. |
-o | Lists jobs in schedule order. This flag is useful only with the -l flag. |
-q Queue | Specifies the queue in which to schedule a job for submission.
When used with the -l flag, the report is limited to the queue
specified by the Queue variable. By default, at
jobs are scheduled in the a queue. The b, c and
d queues are reserved for batch jobs, cron jobs, and sync jobs respectively.
|
-r Job... | Removes Jobs previously scheduled by the at or batch commands, where Job is the number assigned by the at or batch commands. If you do not have root user authority (see the su command), you can remove only your own jobs. The atrm command is available to the root user to remove jobs issued by other users or all jobs issued by a specific user. |
-s | Requests that the bsh command (Bourne shell) be used for executing this job. |
-t Date | Submits the job to be run at the time specified by the Date variable. |
-u User | Deletes all jobs for the specified user. If used with the -r flag, do not specify a Job variable (the correct syntax is at -r -u User). |
Auditing Events: If the
auditing subsystem has been properly configured and is enabled, the
at command will generate the following audit record (event) every
time the command is executed:
Event | Information |
---|---|
AT_JobAdd | Lists at jobs that were run, the time the task was completed, and the user who issued the command. |
See "Setting Up an Auditing System" in AIX 5L Version 5.1 System Management Guide: Operating System and Devices for more details about how to properly select and group audit events, and how to configure audit event data collection.
This command returns the
following exit values:
0 | The at command successfully submitted, removed, or listed a job or jobs. |
>0 | An error occurred. |
If uuclean is in your current directory, enter:
at 5 pm Friday uuclean <Ctrl-D> at now next week uuclean <Ctrl-D>
If uuclean is in $HOME/bin/uuclean, enter:
at now + 2 days $HOME/bin/uuclean <Ctrl-D>
Note: When entering a command name as the last item on the command line, a full path name must be given if the command is not in the current directory, and the at command will not accept any arguments.
echo uuclean | at 3:00 pm January 24 echo uuclean | at 3pm Jan 24 echo uuclean | at 1500 jan 24
echo "ksh shellfile" | at now tomorrow
/var/spool/cron/atjobs | Contains the spool area directory for at. |
The atq command, atrm command, auditpr command, batch command, bsh command, kill command, ksh command, mail command, nice command, ps command, sh command, su command.
The cron daemon.
The environment file.
Auditing Overview in AIX 5L Version 5.1 System Management Guide: Operating System and Devices provides more information about audits and audit events.
Input and Output Redirection Overview in AIX 5L Version 5.1 System Management Guide: Operating System and Devices describes how the operating system processes input and output.
National Language Support Overview for Programming in AIX 5L Version 5.1 System Management Guide: Operating System and Devices explains collating sequences, equivalence classes, and locale.
Shells Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices describes what shells are, the different types of shells, and how shells affect the way commands are interpreted.