AT, BATCH(1,C) AIX Commands Reference AT, BATCH(1,C) ------------------------------------------------------------------------------- at, batch PURPOSE Runs commands at a later time. SYNTAX +-----------+ +- today -+ +-------------+ +--------+ at ---| +-------+ |--- time ---| |---| |---| |-+ +-| -m -k |-+ +- date --+ +- increment -+ +- file -+ | || -c -s | |---| |+-------+ | |+--- -l ---+ | +| |------------------------------------------------------+ +- -r job -+ +-----------+ +--------+ +-| +-------+ |---| |-+ | +-| -m -k |-+ +- file -+ | batch ---| | -c -s | |---| | +-------+ | |------ -l ------------------| +------ -r job --------------+ DESCRIPTION The at and batch commands read the names of commands to be run at a later time from file or standard input: o at allows you to specify when the commands should be run. o batch runs jobs when the system load level permits. Both at and batch mail you all output from standard output and standard error for the scheduled commands, unless you redirect that output. They also write the job number and the scheduled time to standard error. Variables in the shell environment, the current directory, umask, and ulimit are retained when the commands are run. Open file descriptors, traps, and priority are lost. You can use at if your name appears in the file /usr/adm/cron/at.allow. If that file does not exist, at checks the file /usr/adm/cron/at.deny to determine if you should be denied access to at. If neither file exists, only the superuser can submit a job. The allow/deny files contain one user name per line. If at.allow does exist, the superuser's login name must be included in it for the superuser to be able to use the command. Processed November 8, 1990 AT, BATCH(1,C) 1 AT, BATCH(1,C) AIX Commands Reference AT, BATCH(1,C) The required time parameter can be one of the following: 1. 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 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 a suffix of am, pm, or zulu. (a.m. can be abbreviated a and p.m. can be abbreviated p.) If you do not specify am or pm, at uses a 24-hour clock. The suffix zulu indicates that the time is GMT (Greenwich Mean Time). 2. The at command also recognizes the following keywords as special times: noon, midnight, and now. (noon can be abbreviated N and midnight can be abbreviated M.) You can use the special word now only if you also specify a date or an increment. Otherwise, at tells you: "too late". The default format and English words recognized by the at and batch commands are replaced by their locale-specific equivalents found in the environment file. For more information, see the setlocale subroutine in the AIX Technical Reference. The at command recognizes two special days, today and tomorrow, by default. The today is the default date if the specified time is later than the current hour; tomorrow 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. The optional increment can be one of the following: o A + (plus sign) followed by a number and one of the following words: minute[s], hour[s], day[s], week[s], month[s], year[s] (or their non-English equivalents). o The special word next followed by one of the following words: minute[s], hour[s], day[s], week[s], month[s], year[s] (or their non-English equivalents). The LANG environment variable specifies the non-English equivalents of the English defaults. The optional file is as follows: o Only shell scripts can be specified on the command line. If the program is a real program, it must come from standard input (or placed into a shell file). FLAGS Processed November 8, 1990 AT, BATCH(1,C) 2 AT, BATCH(1,C) AIX Commands Reference AT, BATCH(1,C) -r job... Removes jobs previously scheduled by at or batch, where job is the number assigned by at or batch. If you do not have superuser authority (see "su"), you can remove only your own jobs. -c Runs commands using csh as the shell. -k Runs commands using ksh as the shell, if ksh is present. -l Reports your scheduled jobs, including the job number. -m Mails a message to the user about the successful execution of the command. -s Run the commands using the Bourne shell. EXAMPLES 1. To schedule the command uucleanup (which deletes old spool files) from the terminal, use a command similar to one of the following: at 5 pm tomorrow /usr/lib/uucp/uucleanup Ctrl-D at now + 2 days /usr/lib/uucp/uucleanup Ctrl-D These examples run uucp to delete the old uucp files at 5:00 PM tomorrow, or two days in the future, respectively. 2. To run uucleanup to delete the old uucp spool files at 3:00 in the afternoon on the 24th of January, use any one of the following commands: echo /usr/lib/uucp/uucleanup | at 3:00 pm January 24 echo /usr/lib/uucp/uucleanup | at 3pm Jan 24 echo /usr/lib/uucp/uucleanup | at 1500 Jan 24 3. To run a job when the system load permits: batch <&1 >outfile | mail myID ! This example shows the use of a here document to send standard input to at (see "Inline Input Documents"). The order of redirections is important here, so that only error messages are sent into the pipe to the mail command. If you reverse the order, both standard error and standard output are sent to "outfile" (see the discussion of "Input and Output Redirection Using File Descriptors" for details). 4. To have a job reschedule itself, invoke at from within the shell procedure by including code similar to the following within the shell file: echo "sh shellfile" | at now tomorrow 5. To list the jobs you have sent to be run later: Processed November 8, 1990 AT, BATCH(1,C) 3 AT, BATCH(1,C) AIX Commands Reference AT, BATCH(1,C) at -l 6. To cancel jobs: at -r 103 227 This cancels jobs "103" and "227". Use at -l to list the job numbers assigned to your jobs. FILES /usr/adm/cron Main cron directory. /usr/adm/cron/at.allow List of allowed users. /usr/adm/cron/at.deny List of denied users. /usr/spool/cron/atjobs Spool area. RELATED INFORMATION See the following commands: "cron," "kill," "mail, Mail," "nice," "ps" and "sh, Rsh." See the environment special facility in AIX Operating System Technical Reference. See "Running Commands at Pre-set Times" and "Introduction to International Character Support" in Managing the AIX Operating System. Processed November 8, 1990 AT, BATCH(1,C) 4