Task Schedule:
1. Perform a task at a future point in time:
#at
#at [OPTION] Time
At>command
At>, .....
At>ctrl+d Submit
[OPTION]
-L Displays the job list, equivalent to the #atq command
The display format is as follows:
JOBID RUNTIME ALIGNMENT USER
ALIGNMENT (queues) can only be represented by a single character, and the default queue is listed as a.
-D JOBID Delete job, equivalent to the #atrm command.
Time
Absolute time:
Hh:mm the next most recent time.
Mm/dd/yy
Dd. Mm. Yy
For example:
#at 10:30
#at 12/31/2015
#at 31.12.2051
Relative time:
Now+numunit
UNIT
Minutes
Hours
Days
Weeks
Blur Time:
Noon 12 O'Clock Noon
Midnight 12 o'clock in the morning
Teatime 4 o'clock in the afternoon
For example:
now+3m
The result of the execution of the command sent to the user who scheduled the task in the form of a message.
For example:
#at now+3minunts
At>ls/var
At>cat/etc/fstab
At>ctrl+d
At White list and blacklist:
/etc/at.allow White List
/etc/at.deny blacklist
The relationship between the two is as follows:
1. Only/etc/at.allow exist, only users in the whitelist can use the AT command.
2. Only/etc/at.deny exist, any user in the blacklist cannot use the AT command.
3. If none of the two are present, only the superuser can use the AT command.
4. Empty/etc/at.deny means that anyone can use the AT command. This is a default setting.
#batch
You do not need to specify a time to perform the task when the system is idle. Other usage methods are the same as at.
2. Perform a task periodically:
Cron: itself is a service with uninterrupted operation and the service name is Crond.
System Cron Task
/etc/crontab
Shell=/bin/bash
Path=/sbin:/bin:/usr/sbin:/usr/bin
Mailto=root
home=/
Minutes Hours Day Month Week user tasks
User Cron Task
/var/spool/cron/username
Minutes Hours Day Month Week task
To set a valid value for the time of the task:
Minutes: 0-59
Hours: 0-23
Days: 1-32
Month: 1-23
Week: 0-7,0 and 7 both indicate Sunday
The wildcard representation of time:
* Valid values for all time corresponding
, discrete-time point values
-Continuous point-in-time
/num corresponds to the range of values not long
For example:
3 * * * * 3 minutes per hour of execution.
3 * * * 7 per hour of each Sunday for the 3-minute execution.
13 12 * * * every day of 12:13 execution.
13 12 * * 5 is executed at 12:13 per week at 5.
13 12 6 * * Every month, 6th, 12:13 execution.
13 12 6 * 3 each month 6th is executed at the same time as 12:13 on the day of Week 3.
13 12 6 7 * July 6 12:13 every year.
10,40 * * * * 10 minutes and 40 minutes per hour.
10,40 * * 2,5 2 and weekly 5 hours 10 minutes and 40 minutes per week.
10 02 * * 1-5 is executed from 1 to 5 2:10 per week.
*/3 * * * * is performed every 3 minutes.
1 */2 * * * Every 2 hours of 1 minutes to execute.
The execution results are sent to the administrator as a message.
For example:
*/3 * * * * */bin/cat/etc/fstab >/dev/null Send the correct information to/dev/null, the wrong information will be retained.
Cron Environment variables: All the commands that Cron executes go down the path where the paths environment variable is set.
Path/bin:/sbin:/usr/bin:/usr/sbin
#crontab [OPTION]
[OPTION]
-L lists all cron tasks for the current user
-E editing tasks
-R removes all tasks. The essence is to delete the cron task file.
-U USERNAME Specify other users
Anacron
Cron's supplemental program, which enables Cron to perform tasks that have not been performed in the past time for other reasons, executes once after normal recovery. The service name is Anacron.
/etc/anacrontab
Shell=/bin/bash
Path=/bin:/sbin:/usr/bin:/usr/sbin
Maitto=root
Past non-executed cycles specify minutes after boot to perform annotation information tasks
This article is from "Small Private blog" blog, please be sure to keep this source http://ggvylf.blog.51cto.com/784661/1615380
Linux Task Scheduler