[Reprint] A developer needs to be familiar with the common Linux commands of the second: Crontab

Source: Internet
Author: User

It said so many common commands, there is a function we also often use, is the timer, schedule, generally through the crontab to run;crontab specifies that specific scripts are executed at fixed or fixed intervals; crontab has the following 3 common parameters:

-E: Executes the text editor to set the schedule, the general default editor is VI;

-R: Delete all current schedules;

-L: Lists all current schedules;

To set the schedule, you need to have a fixed format, a total of 6 parts, with space between the sections, the 6th part is the command to execute, the first 5 parts are set execution time or time interval, the specific value range and meaning are as follows:

Minutes "0-59" hours "0-23" Day "1-31" month "1-12" Week "0-6"

There are 4 ways to specify each item at the time of Setup, as follows:

*: Indicates that every minute of/.../week needs to be executed;

A-B: indicates that the period from/.../week to/.../week of the first minute should be enforced;

*/n: Indicates that every n minutes/.../week interval is executed once;

A,b,c: Indicates that a,b,c minute/.../week is required to execute, that is, specify more than one specific point in time;

For example, for example, to specify that the crontab setting of the script Mysh every morning 7 is as follows:

0 7 * * */home/admin/mysh >/home/admin/mylog.txt 2>&1

One of the redirection symbols, 2>&1 and other representatives of the meaning can be see Http://blog.csdn.net/sfdev/archive/2008/07/29/2729680.aspx;

The Java Timing Framework Quartz also supports a timing scheduling policy configuration similar to Crontab, and is configured almost exactly the same way, as described in the following:
Http://blog.csdn.net/sfdev/archive/2009/03/02/3950640.aspx

Original

http://blog.csdn.net/sfdev/article/details/4025916

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.