Crondtab Scheduled Tasks in Linux

Source: Internet
Author: User

Crond is a daemon that is used to periodically perform certain tasks or wait for certain events under Linux, similar to Scheduled tasks under Windows, when the operating system is installed, the Service tool is installed by default and the Crond process is started automatically. The Crond process periodically checks to see if there is a task to perform and automatically executes the task if there are tasks to perform. In the/etc directory there is a crontab file, this is the System Task Scheduler configuration file.


In the case of unmodified, the contents of/etc/crontab are as follows:

Shell=/bin/bash Path=/sbin:/bin:/usr/sbin:/usr/bin Mailto=root# Example of job definition:   
#.----------------minute (0-59)  
# |  .-------------Hour (0-23)  
# |  |  .----------Day of Month ( 1-31)  
# |  |  |  .-------month (1-12) OR jan,feb,mar,apr. .  
# |  |  |  |  .----Day of Week (0-6) (sunday=0 or 7) or Sun,mon,tue,wed,thu,fri,sat  
# *  *  *  *  * user-name  command to be execut Ed

The previous 3 lines are the environment variables used to configure the Crond task to run


    • from line 7th to line 14th is the setting reference for Crontab. The specific meaning has been explained very clearly, the setting reference identifies the range of values,


In each of these fields, you can also use the following special characters:


  • Asterisk (*): represents all possible values, such as the month field if it is an asterisk, the command action is executed monthly after the constraints of other fields are met.

  • Comma (,): You can specify a list range with a comma-separated value, for example, "1,2,5,7,8,9"

  • Middle Bar (-): An integer range can be represented by a middle bar between integers, such as "2-6" for "2,3,4,5,6"

  • Forward slash (/): You can specify the interval frequency of the time with a forward slash, such as "0-23/2", which is performed every two hours. A forward slash can be used with asterisks, such as */10, if used in the minute field, which means that it executes every 10 minutes.

  • Sunday with 0 or 7

  • Case:

*/5 5-10 1-4,8-11 * 1-5 root user command commands

Every 5 minutes between 5 and 10 points from Monday to Friday, 1-4 days, 8-11 days a week


Crondtab Scheduled Tasks in Linux

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.