Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cron(1M)

crontab(1)

queuedefs(4)

proto(4)

kill(1)

mail(1)

nice(1)

ps(1)

sh(1)

hpnls(5)

at(1)

NAME

at, batch − execute commands at a later time

SYNOPSIS

at [-m] [-f filename] [-q queue] time [date] [[next | +increment] time_designation] job ...

at -r job_id ...
at -l [job_id ...]

batch

DESCRIPTION

at, in the first form shown above, and batch read commands from standard input to be executed at a later time:

at Executes commands at a specified time. 

batch Executes commands when system load level permits. 

In the second and third forms, at respectively removes one or more currently scheduled jobs, or lists some or all currently scheduled jobs. 

An at_job consists of one or more executable commands exectuable by the shell.  at creates a shell script in /usr/spool/cron/atjobs, the first part of which sets up the environment to match that of the invoking user.  The second part of the script consists of the commands entered by the user.  When cron dispatches the job it execs a shell to execute the command file (script). 

Options

at recognizes the following options and command-line arguments where job is any valid HP-UX command:

-l [job_id ...]
List all jobs currently scheduled for the invoking user. If job_ids are given, only the specified jobs are listed. 

-r job_id ... 
Remove the jobs with the specified job_ids that were previously scheduled by the at command.  Job_id is the job number assigned by at when the job was originally scheduled.  When removing multiple jobs, use blanks to separate job_ids.

-m Send mail to the invoking user after the job has run, announcing its completion.  Standard output and standard error produced by the job are mailed to the user as well, unless they were redirected elsewhere within the job. 

-ffilename Specify the pathname of a file to be used as the source of the job, instead of standard input. 

-qqueue Submit the specified job to the queue indicated (see queuedefs(4)). Queues a, b, and d through y can be used.  at uses queue a by default.  All queues require a time designation except queue b which runs as soon as system load level permits.  Queue b is reserved for use by the batch command. 

time Can be specified as one, two, or four digits.  One- and two-digit numbers represent hours; four digits represent hours and minutes.  Alternately, time can be specified as two numbers separated by a colon (:), single quote (’), the letter "h" (h), a period (.), or comma (,). If defined in langinfo(3C), special time unit characters can be used. A suffix am or pm can be appended.  Otherwise a 24-hour clock time is understood.  For example, 8:15, 8’15, 8h15, 8.15, and 8,15 are read as 15 minutes after 8 in the morning.  The suffixes zulu and utc can be used to indicate Coordinated Universal Time.  The special names noon, midnight, now, and next are also recognized. 

date (optional) Can be specified as either a day of the week (fully spelled out or abbreviated) or a date consisting of a day, a month, and optionally a year.  The day and year fields must be numeric, and the month can be either fully spelled out, abbreviated, or numeric.  These three fields can be in any order, and separated by punctuation marks such as /, -, ., or ,.  If defined in langinfo(3C), special date unit characters can be present. Two special “days”, today and tomorrow, are also recognized.  If no date is given, today is assumed if the given time is greater than the current time; tomorrow is assumed if it is less.  If the given month is less than the current month (and no year is given), next year is assumed.  If a given date is ambiguous (such as 2/5), the D_T_FMT string (if defined in langinfo(3C)) is used to resolve the ambiguity.

next

or

+increment (optional) If followed by a time_designation of minutes, hours, days, weeks, months, or years, lets the user schedule a task to be executed when the specified time_designation has elapsed.  A numerical operator, +increment, enables the user to schedule the task several hours, days, weeks, months, or years in advance (see EXAMPLES).  Using the argument next is equivalent to using an increment of +1.  Both plural and singular forms of time_designation are accepted. 

Standard output and standard error output are mailed to the user unless they are redirected elsewhere.  The shell environment variables, current directory, umask (see umask(1)) and ulimit (see ulimit(2)) are retained when the commands are executed (see proto(4)). Open file descriptors, traps, and priority are lost.

Only users whose names appear in file /usr/lib/cron/at.allow can run at.  If that file does not exist, file /usr/lib/cron/at.deny is checked to determine if the user should be denied access to at.  If neither file exists, only root is allowed to submit a job.  If only at.deny exists but is empty, global usage is permitted.  The allow/deny files consist of one user name per line. 

The words today, tomorrow, noon, midnight, now, minutes, hours, days, weeks, months, years and their singular forms are replaced by the local language equivalent (see EXTERNAL INFLUENCES below). 

at and batch write the job_id and schedule time to standard error. 

batch submits a batch job.  It is similar to at now, but with the following differences: batch goes into a different queue; at now responds with error messages. 

at -r removes jobs previously scheduled by at or batch.  The job_id is the number returned by the at or batch command.  To get job numbers, typing at -l.  Only users with appropriate privileges can remove jobs other than their own. 

EXTERNAL INFLUENCES

Environment Variables

LC_TIME determines the format and contents of date and time strings. 

LANG determines the translation of the words today, tomorrow, noon, midnight, now, minutes, hours, days, weeks, months, years, next, and their singular forms.  LANG also determines the language in which messages are displayed. 

If LC_TIME is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable.  If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG.  If any internationalization variable contains an invalid setting, at behaves as if all internationalization variables are set to "C".  See IR environ(5). 

International Code Set Support

Single- and multi-byte character code sets are supported. 

RETURN VALUE

Exit code 0 is returned upon successful completion, otherwise 1 is returned. 

DIAGNOSTICS

at complains about syntax errors and out-of-range times. 

If login shell is not /bin/sh, at produces a warning message as a reminder that at jobs are executed using /bin/sh. 

EXAMPLES

The at and batch commands read from standard input the commands to be executed at a later time, unless the -f option is specified.  sh(1) provides different ways of specifying standard input. Within your commands, it may be useful to redirect standard output.

The following sequence can be used at a terminal to redirect output:

batch
nroff filename > outfile
<Ctrl-D>

This sequence demonstrates redirecting standard error to a pipe and is useful in a shell procedure.  Note that the sequence of output redirection specifications is significant:

batch <<!
nroff filename 2>&1 > outfile | mail loginid
!

To perform a task at 5:00 am next Tuesday, use

at 5am tuesday next week

To perform a task at 5:00 am one week from Tuesday (that is, 2 Tuesdays in advance) use

at 5am tuesday + 2 weeks

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 1900 thursday next week

The following commands show several forms recognized by at and include native language usage:

at 0815 Jan 24
at 8:15 Jan 24
at 9:30am tomorrow
at now + 1 day
at -f job 5 pm Friday
at 17:40 Tor.        /* in Danish */
at 17h46 demain        /* in French */
at 5:30  26. Feb. 1988/* in German */
at 12:00 26-02        /* in Finnish */

WARNINGS

If the date argument begins with a number and the time argument is also numeric without suffix, the time argument should be a four-digit number that can be correctly interpreted as hours and minutes. 

Do not use both next and + increment within a single at command; only the first operator is accepted and the trailing operator is ignored.  No warning or error is produced. 

If the FIFO used to communicate with cron fills up, at is suspended until cron has read sufficient messages from the FIFO to make room for the message at is trying to write.  This condition can occur if at is writing messages faster than cron can process them or if cron is not executing. 

AUTHOR

at was developed by AT&T and HP. 

FILES

/usr/lib/cron main cron directory

/usr/lib/cron/at.allow list of allowed users

/usr/lib/cron/at.deny list of denied users

/usr/spool/cron/atjobs spool area

/usr/lib/cron/queuedefs scheduling information

/usr/lib/cron/.proto prototype information

SEE ALSO

cron(1M), crontab(1), queuedefs(4), proto(4), kill(1), mail(1), nice(1), ps(1), sh(1), hpnls(5). 

STANDARDS CONFORMANCE

at: SVID2, XPG2, XPG3

batch: SVID2, XPG2, XPG3

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026