The AT command in Linux is detailed

Source: Internet
Author: User
Tags aliases touch command uppercase letter

At Command: One: Introduction:

Schedule a task, perform a work at a specific time, execute at a specific time, need to install at service, Apt-get installed at

Two: Time definition:

At allows you to use a fairly complex set of time-specific methods.
Be able to accept the time specified in the hh:mm (Hours: minutes) of the day. If the time has passed, then it will be executed the next day. Example: 04:00
Can use Midnight (late night), noon (noon), Teatime (tea time, usually 4 o'clock in the afternoon) and other vague words to specify the time.
Be able to use the 12-hour timekeeping system, that is, after the time plus AM (morning) or PM (afternoon) to indicate whether it is morning or afternoon. Example: 12pm
Ability to specify a specific date for the execution of the command, specifying the format for Month Day (month) or mm/dd/yy (Month/day/year) or Dd.mm.yy (day. Month), the specified date must be followed by the specified time. Example: 04:00 2009-03-1
Be able to use relative timing method. The specified format is: Now + Count Time-units, today is the current time, Time-units is the time unit, here can be minutes (minutes), hours (hours), Days (day), Weeks (week). Count is the amount of time, days, hours. For example: Now + 5 minutes 04pm + 3 days
The ability to specify the time to complete a command directly using today (present), Tomorrow (Tomorrow).

Three: Syntax:

at (option) (parameter)

Four: Options:

-M: When the specified task is completed, the user will be sent a message, even if there is no standard output
-M: Do not send mail
Aliases for-L:ATQ
Aliases for-D:ATRM
Aliases for-R:ATRM
-V: Shows the time that the task will be executed and the time format shown is: Thu Feb 20 14:50:00 1997
-C: Print the contents of the task to standard output
-V: Display version information
-Q: Back add < queue > use specified queue
-F: Append < file > read into task from specified file instead of reading from standard input
-T: Back < time parameters > submit a task to run in the form of a time parameter

V: Related commands:

At: Perform one-time tasks at specific times
ATQ: Lists the user's scheduled tasks, and if the Superuser will list the tasks for all users, the output format for the results is: job number, date, hour, queue, and user name
ATRM: Delete the at task based on job number
Batch: Perform an at task when the system load allows, in other words, to perform an at task when the system is idle

Six: Parameters:

DateTime: Specifies the date and time that the task is executed
Additions to the queue:
The-q option follows the queue name to execute the at task with the specified queue
Queue name contains only one letter, valid queue name value range is: lowercase letter A-Z or uppercase letter A-Z
The A queue is the default queue for the AT command by default, and B queues as the default queue for the batch command
The larger the letters, the higher the priority they have when they are executed.
"=" is reserved for use by the currently running at task as a special queue
If you create an at scheduled task that uses uppercase letters to specify a queue for a task, the task is processed as a batch scheduled task when it is executed
If you specify a queue name when querying at tasks using ATQ, the results of the query will only contain tasks under this queue
Additions to the-t option:
The-t option performs an at task at the time specified by the time_arg time parameter
The format of the time after this parameter must be in the same format as the time required by the touch command-t option
The format of the Time_arg is [[CC]YY]MMDDHHMM[.SS]
CC the first two digits of the specified year
YY the following two digits for the specified year
MM designation which January of the year (from 01 to 12)
DD specifies which day of January (from 01 to 31)
HH specifies which hour of the day (from 00 to 23)
MM specifies which minute of an hour (from 00 to 59)
SS specifies which second of a minute (from 00 to 59)

Seven: Related configuration files:

The exact definition of the time specification can be viewed in/usr/share/doc/at-3.1.10/timespec
By default, the scheduled tasks are placed in the/var/spool/at/file.
The root user can use the AT command under any circumstances, while others using the AT command are defined in/etc/at.allow (users who are allowed to use scheduled tasks) and/etc/at.deny (users who are denied use of scheduled tasks) in the file
If the/etc/at.allow file exists, only the user name in the file can use the at
If the/etc/at.allow file does not exist,/etc/at.deny exists, and all users who are not in the/etc/at.deny file can use the at
At.allow higher priority than At.deny, execute the user can execute at command, first see At.allow file not only see At.deny file
If both the/etc/at.allow and/etc/at.deny files do not exist, only the root user can use the at
An empty content/etc/at.deny means that any user can use the AT command, which is the default configuration
In general, these two files exist in one of the following. If only a few users need to use a scheduled task, then keep the At.allow file, and if most users want to use scheduled tasks, then keep At.deny

Eight: Create an at task:

There are two ways to create an at task, from file entry and input from the console. The following are two ways to create a command that writes the current time to a/root/learngit file after 1 minutes, respectively

1. File Input:

2. Console input:

Nine: Example:



The AT command in Linux is detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.