Linux Task Scheduler

Source: Internet
Author: User

Task Schedule:

1. Perform a task at a future point in time:


#at [OPTION] Time


At>, .....

At>ctrl+d Submit


-L Displays the job list, equivalent to the #atq command

The display format is as follows:


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.


Absolute time:

Hh:mm the next most recent time.


Dd. Mm. Yy

For example:

#at 10:30

#at 12/31/2015

#at 31.12.2051

Relative time:







Blur Time:

Noon 12 O'Clock Noon

Midnight 12 o'clock in the morning

Teatime 4 o'clock in the afternoon

For example:


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 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.


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






Minutes Hours Day Month Week user tasks

User Cron Task


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.


#crontab [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


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.





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

Linux Task Scheduler

Related Article

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: 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.