AT(1POSIX)
โจ AT(1POSIX) โจ
okay so bestie, this is the POSIX Programmer's Manual page for at. It's giving "schedule your little shell tasks for later" energy, and we're gonna read it together. ๐ซถ
๐ธ PROLOG ๐ธ
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux at all. No cap, that's just how it is. ๐
๐ NAME ๐
at โ execute commands at a later time
๐ SYNOPSIS ๐
at [-m] [-f file] [-q queuename] -t time_arg
at [-m] [-f file] [-q queuename] timespec...
at -r at_job_id...
at -l -q queuename
at -l [at_job_id...]
๐ฆ DESCRIPTION ๐ฆ
Okay so at shall read commands from standard input and group them together as an at-job, to be executed at a later time. Time capsule, but make it shell commands. โจ
The at-job shall be executed in a separate invocation of the shell, running in a separate process group with no controlling terminal โ except that the environment variables, current working directory, file creation mask, and other implementation-defined execution-time attributes in effect when the at utility is executed shall be retained and used when the at-job is executed. So it keeps those vibes, but it does not keep the terminal. ๐
When the at-job is submitted, the at_job_id and scheduled time shall be written to standard error. The at_job_id is an identifier that shall be a string consisting solely of alphanumeric characters and the <period> character. The at_job_id shall be assigned by the system when the job is scheduled such that it uniquely identifies a particular job. It's literally the job's little name tag. ๐ท๏ธ
User notification and the processing of the job's standard output and standard error are described under the -m option. We'll get there, bestie, don't worry. ๐
Users shall be permitted to use at if their name appears in the file at.allow which is located in an implementation-defined directory. If that file does not exist, the file at.deny, which is located in an implementation-defined directory, shall be checked to determine whether the user shall be denied access to at. If neither file exists, only a process with appropriate privileges shall be allowed to submit a job. If only at.deny exists and is empty, global usage shall be permitted. The at.allow and at.deny files shall consist of one user name per line. So yeah, access control is giving very "guest list at the club" energy. ๐
โจ OPTIONS โจ
The at utility shall conform to the Base Definitions volume of POSIX.1โ2017, Section 12.2, Utility Syntax Guidelines.
The following options shall be supported:
-f fileโ Specify the pathname of a file to be used as the source of the at-job, instead of standard input.-lโ (The letter ell.) Report all jobs scheduled for the invoking user if noat_job_idoperands are specified. Ifat_job_idsare specified, report only information for these jobs. The output shall be written to standard output.-mโ Send mail to the invoking user after the at-job has run, announcing its completion. Standard output and standard error produced by the at-job shall be mailed to the user as well, unless redirected elsewhere. Mail shall be sent even if the job produces no output.
If -m is not used, the job's standard output and standard error shall be provided to the user by means of mail, unless they are redirected elsewhere; if there is no such output to provide, the implementation need not notify the user of the job's completion.
-q queuenameโ Specify in which queue to schedule a job for submission. When used with the-loption, limit the search to that particular queue. By default, at-jobs shall be scheduled in queuea. In contrast, queuebshall be reserved for batch jobs; seebatch. The meanings of all otherqueuenames are implementation-defined. If-qis specified along with either of the-t time_argortimespecarguments, the results are unspecified.-rโ Remove the jobs with the specifiedat_job_idoperands that were previously scheduled by theatutility.-t time_argโ Submit the job to be run at the time specified by the time option-argument, which the application shall ensure has the format as specified by thetouch -ttime utility.
๐ฏ OPERANDS ๐ฏ
okay so these are the things you can hand it, bestie:
at_job_idโ the name that a previous run of theatutility reported back when the job got scheduled. that's the whole vibe.timespecโ this is the big one. you're submitting the job to run at the date and time you specify. every singletimespecoperand gets interpreted as if they were all separated by<space>characters and then glued together, and parsed according to the grammar at the end of this section. the date and time are read as being in your timezone (as figured out by theTZvariable), unless a timezone name shows up as part of time, which we're getting to below.
In the POSIX locale, here's the breakdown of the three parts of the time specification string. And all the values from the LC_TIME categories in the POSIX locale get recognized in a case-insensitive way. ๐
timeโ the time can be one, two, or four digits. one-digit and two-digit numbers count as hours; four-digit numbers count as hours and minutes. alternatively you can do two numbers separated by a<colon>, meaning hour:minute. an AM/PM indication (one of the values from theam_pmkeywords in theLC_TIMElocale category) can follow the time โ and if you don't give one, a 24-hour clock time is assumed. a timezone name can follow too, to further qualify the time. the acceptable timezone names are implementation-defined, except that they shall be case-insensitive and the stringutcis supported to say the time is in Coordinated Universal Time. In the POSIX locale, the time field can also be one of these tokens:midnightโ indicates the time 12:00 am (00:00).noonโ indicates the time 12:00 pm.nowโ indicates the current day and time. invokingat <now>shall submit an at-job for potentially immediate execution (that is, subject only to unspecified scheduling delays). โจ
dateโ an optional date can be either a month name (one of the values from themonorabmonkeywords in theLC_TIMElocale category) followed by a day number (and possibly a year number preceded by a comma), or a day of the week (one of the values from thedayorabdaykeywords in theLC_TIMElocale category). In the POSIX locale, two special days shall be recognized:todayโ indicates the current day.tomorrowโ indicates the day following the current day.
If no date is given, today shall be assumed if the given time is greater than the current time, and tomorrow shall be assumed if it's less. If the given month is less than the current month (and no year is given), next year shall be assumed. ๐๏ธ
incrementโ the optional increment shall be a number preceded by a<plus-sign>('+') and suffixed by one of:minutes,hours,days,weeks,months, oryears. (the singular forms shall also be accepted.) the keywordnextshall be equivalent to an increment number of+1. for example, these are equivalent commands:
at 2pm + 1 week
at 2pm next week
The following grammar describes the precise format of timespec in the POSIX locale. The general conventions for this style of grammar are described in Section 1.3, Grammar Conventions. This formal syntax shall take precedence over the preceding text syntax description. The longest possible token or delimiter shall be recognized at a given point. When used in a timespec, white space shall also delimit tokens.
%token hr24clock_hr_min
%token hr24clock_hour
/*
An hr24clock_hr_min is a one, two, or four-digit number. A one-digit
or two-digit number constitutes an hr24clock_hour. An hr24clock_hour
may be any of the single digits [0,9], or may be double digits, ranging
from [00,23]. If an hr24clock_hr_min is a four-digit number, the
first two digits shall be a valid hr24clock_hour, while the last two
represent the number of minutes, from [00,59].
*/
%token wallclock_hr_min
%token wallclock_hour
/*
A wallclock_hr_min is a one, two-digit, or four-digit number.
A one-digit or two-digit number constitutes a wallclock_hour.
A wallclock_hour may be any of the single digits [1,9], or may
be double digits, ranging from [01,12]. If a wallclock_hr_min
is a four-digit number, the first two digits shall be a valid
wallclock_hour, while the last two represent the number of
minutes, from [00,59].
*/
%token minute
/*
A minute is a one or two-digit number whose value can be [0,9]
or [00,59].
*/
%token day_number
/*
A day_number is a number in the range appropriate for the particular
month and year specified by month_name and year_number, respectively.
If no year_number is given, the current year is assumed if the given
date and time are later this year. If no year_number is given and
the date and time have already occurred this year and the month is
not the current month, next year is the assumed year.
*/
%token year_number
/*
A year_number is a four-digit number representing the year A.D., in
which the at_job is to be run.
*/
%token inc_number
/*
The inc_number is the number of times the succeeding increment
period is to be added to the specified date and time.
*/
%token timezone_name
/*
The name of an optional timezone suffix to the time field, in an
implementation-defined format.
*/
%token month_name
/*
One of the values from the mon or abmon keywords in the LC_TIME
locale category.
*/
%token day_of_week
/*
One of the values from the day or abday keywords in the LC_TIME
locale category.
*/
%token am_pm
/*
One of the values from the am_pm keyword in the LC_TIME locale
category.
*/
%start timespec
%%
timespec : time
| time date
| time increment
| time date increment
| nowspec
;
nowspec : "now"
| "now" increment
;
time : hr24clock_hr_min
| hr24clock_hr_min timezone_name
| hr24clock_hour ":" minute
| hr24clock_hour ":" minute timezone_name
| wallclock_hr_min am_pm
| wallclock_hr_min am_pm timezone_name
| wallclock_hour ":" minute am_pm
| wallclock_hour ":" minute am_pm timezone_name
| "noon"
| "midnight"
;
date : month_name day_number
| month_name day_number "," year_number
| day_of_week
| "today"
| "tomorrow"
;
increment : "+" inc_number inc_period
| "next" inc_period
;
inc_period : "minute" | "minutes"
| "hour" | "hours"
| "day" | "days"
| "week" | "weeks"
| "month" | "months"
| "year" | "years"
;
๐ฅ STDIN ๐ฅ
The standard input shall be a text file consisting of commands acceptable to the shell command language described in Chapter 2, Shell Command Language. Standard input only gets used if you didn't pass a -f file option, no cap. ๐ซถ
๐ INPUT FILES ๐
See the STDIN section, bestie โ it's right there. ๐
The text files at.allow and at.deny, which live in an implementation-defined directory, shall contain zero or more user names, one per line, of users who are, respectively, authorized or denied access to the at and batch utilities. so basically: one line per user, and that's your guest list. ๐
๐ ENVIRONMENT VARIABLES ๐
Okay bestie, here's the tea on which env vars are gonna affect how at behaves when it runs. Pay attention, this part matters ๐
LANGโ gives a default value for all the internationalization variables that are unset or null. (Peep the Base Definitions volume of POSIX.1โ2017, Section 8.2, Internationalization Variables, for the precedence rules that decide which internationalization variables actually win.)LC_ALLโ if you set this to a non-empty string value, it overrides the values of all the other internationalization variables. It's giving main character energy, it just steamrolls everyone else ๐LC_CTYPEโ sets the locale for how sequences of bytes of text data get interpreted as characters (think single-byte versus multi-byte characters in arguments and input files).LC_MESSAGESโ sets the locale that affects the format and contents of diagnostic messages written to standard error, and informative messages written to standard output.NLSPATHโ sets the location of message catalogs for the processing ofLC_MESSAGES.LC_TIMEโ sets the format and contents for date and time strings thatatwrites and accepts.SHELLโ sets a name of a command interpreter to be used to invoke the at-job. If this variable is unset or null,shshall be used. If it's set to a value other than a name forsh, the implementation shall do one of the following: use that shell; usesh; use the login shell from the user database; or any of the preceding accompanied by a warning diagnostic about which was chosen. (Yeah, it's a pick-your-own-adventure situation, lowkey wild but that's the spec ๐ซ )TZโ sets the timezone. The job shall be submitted for execution at the time specified by timespec or-ttime relative to the timezone specified by theTZvariable. If timespec specifies a timezone, it shall overrideTZ. If timespec does not specify a timezone andTZis unset or null, an unspecified default timezone shall be used.
โก ASYNCHRONOUS EVENTS โก
Default. That's it, that's the whole section. Nothing spicy here, moving on ๐ฆ
๐ค STDOUT ๐ค
When standard input is a terminal, prompts of unspecified format for each line of the user input described in the STDIN section may be written to standard output.
In the POSIX locale, the following shall be written to the standard output for each job when jobs are listed in response to the -l option:
"%s\t%s\n", at_job_id, <date>
where date shall be equivalent in format to the output of:
date +"%a %b %e %T %Y"
The date and time written shall be adjusted so that they appear in the timezone of the user (as determined by the TZ variable). Yes bestie, it flexes to your timezone, it's personalized โจ
๐ข STDERR ๐ข
In the POSIX locale, the following shall be written to standard error when a job has been successfully submitted:
"job %s at %s\n", at_job_id, <date>
where date has the same format as that described in the STDOUT section. Neither this, nor warning messages concerning the selection of the command interpreter, shall be considered a diagnostic that changes the exit status. So like, don't panic, it's just chatting ๐ซถ
Diagnostic messages, if any, shall be written to standard error.
๐ OUTPUT FILES ๐
None. Empty. Void. Nothing to see here ๐ณ๏ธ
๐ EXTENDED DESCRIPTION ๐
None. Also empty. Two-for-two on the emptiness ๐
๐ช EXIT STATUS ๐ช
The following exit values shall be returned:
0โ Theatutility successfully submitted, removed, or listed a job or jobs. Slay, it worked ๐>0โ An error occurred. ๐ญ
๐ฅ CONSEQUENCES OF ERRORS ๐ฅ
The job shall not be scheduled, removed, or listed. Periodt. If it errored, nothing happened, no cap.
The following sections are informative. (Translation: they're the lore, not the rules ๐)
๐ง APPLICATION USAGE ๐ง
The format of the at command line shown here is guaranteed only for the POSIX locale. Other cultures may be supported with substantially different interfaces, although implementations are encouraged to provide comparable levels of functionality.
Since the commands run in a separate shell invocation, running in a separate process group with no controlling terminal, open file descriptors, traps, and priority inherited from the invoking environment are lost. It's giving "new shell, who dis" ๐
Some implementations do not allow substitution of different shells using SHELL. System V systems, for example, have used the login shell value for the user in /etc/passwd. To select reliably another command interpreter, the user must include it as part of the script, such as:
$ at 1800
myshell myscript
EOT
job ... at ...
$
๐ EXAMPLES ๐
- This sequence can be used at a terminal:
at -m 0730 tomorrow
sort < file >outfile
EOT
- This sequence, which demonstrates redirecting standard error to a pipe, is useful in a command procedure (the sequence of output redirection specifications is significant):
at now + 1 hour <<!
diff file1 file2 2>&1 >outfile | mailx mygroup
!
- To have a job reschedule itself,
atcan be invoked from within the at-job. For example, this daily processing script namedmy.dailyruns every day (althoughcrontabis a more appropriate vehicle for such work):
# my.daily runs every day
daily processing
at now tomorrow < my.daily
- The spacing of the three portions of the POSIX locale timespec is quite flexible as long as there are no ambiguities. Examples of various times and operand presentation include:
at 0815am Jan 24
at 8 :15amjan24
at now "+ 1day"
at 5 pm FRIday
at '17
utc+
30minutes'
๐ญ RATIONALE ๐ญ
The at utility reads from standard input the commands to be executed at a later time. It may be useful to redirect standard output and standard error within the specified commands.
The -t time option was added as a new capability to support an internationalized way of specifying a time for execution of the submitted job.
Early proposals added a ``jobname'' concept as a way of giving submitted jobs names that are meaningful to the user submitting them. The historical, system-specified at_job_id gives no indication of what the job is. Upon further reflection, it was decided that the benefit of this was not worth the change in historical interface. The at functionality is useful in simple environments, but in large or complex situations, the functionality provided by the Batch Services option is more suitable.
The -q option historically has been an undocumented option, used mainly by the batch utility.
The System V -m option was added to provide a method for informing users that an at-job had completed. Otherwise, users are only informed when output to standard error or standard output are not redirected.
The behavior of at <now> was changed in an early proposal from being unspecified to submitting a job for potentially immediate execution. Historical BSD at implementations support this. Historical System V implementations give an error in that case, but a change to the System V versions should have no backwards-compatibility ramifications.
On BSD-based systems, a -u user option has allowed those with appropriate privileges to access the work of other users. Since this is primarily a system administration feature and is not universally implemented, it has been omitted. Similarly, a specification for the output format for a user with appropriate privileges viewing the queues of other users has been omitted.
The -f file option from System V is used instead of the BSD method of using the last operand as the pathname. The BSD method is ambiguousโdoes:
at 1200 friday
mean the same thing if there is a file named friday in the current directory? Yeah, exactly, chaos ๐
The at_job_id is composed of a limited character set in historical practice, and it is mandated here to invalidate systems that might try using characters that require shell quoting or that could not be easily parsed by shell scripts.
The at utility varies between System V and BSD systems in the way timezones are used. On System V systems, the TZ variable affects the at-job submission times and the times displayed for the user. On BSD systems, TZ is not taken into account. The BSD behavior is easily achieved with the current specification. If the user wishes to have the timezone default to that of the system, they merely need to issue the at command immediately following an unsetting or null assignment to TZ. For example:
TZ= at noon ...
gives the desired BSD result.
While the yacc-like grammar specified in the OPERANDS section is lexically unambiguous with respect to the digit strings, a lexical analyzer would probably be written to look for and return digit strings in those cases. The parser could then check whether the digit string returned is a valid day_number, year_number, and so on, based on the context.
๐ฎ FUTURE DIRECTIONS ๐ฎ
None. The future is empty, bestie, but at least it's consistent โจ
๐ SEE ALSO ๐
batch,crontab- The Base Definitions volume of POSIX.1โ2017, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines
ยฉ๏ธ COPYRIGHT ยฉ๏ธ
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
And that's a wrap on AT(1POSIX), bestie!! ๐ This little baddie is brought to you by IEEE/The Open Group, dated 2017 โ go forth and schedule your jobs responsibly, mwah ๐
๐
๐ฆ where this page comes from
- debian bookworm: manpages-posix 2017a-2 ยท Other
- debian trixie: manpages-posix 2017a-2 ยท Other
- ubuntu jammy: manpages-posix 2017a-2 ยท Other
- ubuntu noble: manpages-posix 2017a-2 ยท Other
- ubuntu resolute: manpages-posix 2017a-2build1 ยท Other
- ubuntu stonking: manpages-posix 2017a-2.1 ยท Other
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms