27.2.3. Configuring an At Job
To schedule a one-time job for a specific time with the At utility, do the following:
- On the command line, type the command
at TIME, where
TIMEis the time when the command is to be executed.The TIME argument can be defined in any of the following formats:
If the specified time has past, the job is executed at the time the next day.
HH:MMspecifies the exact hour and minute; For example,
04:00specifies 4:00 a.m.
midnightspecifies 12:00 a.m.
noonspecifies 12:00 p.m.
teatimespecifies 4:00 p.m.
MONTHDAYYEARformat; For example,
January 15 2012specifies the 15th day of January in the year 2012. The year value is optional.
MM.DD.YYformats; For example,
011512for the 15th day of January in the year 2012.
now + TIMEwhere TIME is defined as an integer and the value type: minutes, hours, days, or weeks. For example,
now + 5 daysspecifies that the command will be executed at the same time five days from now.The time must be specified first, followed by the optional date. For more information about the time format, see the
- In the displayed
at>prompt, define the job commands:
- Type the command the job should execute and press Enter. Optionally, repeat the step to provide multiple commands.
- Enter a shell script at the prompt and press Enter after each line in the script.The job will use the shell set in the user's
SHELLenvironment, the user's login shell, or
/bin/sh(whichever is found first).
- Once finished, press Ctrl+D on an empty line to exit the prompt.
If the set of commands or the script tries to display information to standard output, the output is emailed to the user.
To view the list of pending jobs, use the
atqcommand. See Section 27.2.5, “Viewing Pending Jobs” for more information.
You can also restrict the usage of the
atcommand. For more information, see Section 27.2.7, “Controlling Access to At and Batch” for details.