Common methods for crontab timing scripts

Source: Internet
Author: User
1. Detailed crontab format
Time-Sharing and Lunar Week
*  *  *  *  *

Min 1-59
Hour 1-23 0 means 0 points
Day 1-31
Month 1-12
Week 0-6 0 means Sunday


Data format
1 * * * * The number of the first minute per hour is performed (once per hour)
*/1 * * * * score every Minute
10-30/1 * * * * * * * * * * 10 to 30 minutes per hour
* 23-5 * * * * Range 23 to 5 per day
* 1,3,5 * * * List of 1-point 3-point 5-point execution per day

Every 30 minutes
*/30 * * * * * *
0,30 * * * * * *

2. Crontab Common Commands
Crontab-e Edit timed execution script
Crontab-l View timed execution scripts

Linux:service Crond Restart
/etc/init.d/crond restart
Mac:sudo/usr/sbin/cron restart

3. Crontab execution result saved to specified file
Timed script execution results saved to current date file

* * * echo ' 123 ' >>/tmp/$ (date +%y-%m-%d). log

Timed script saves specified output and error records


0,30 * * * */usr/local/a.sh >>/tmp/log/a.log 2>&1


2>&1 indicates that the error and standard output are also exported to the A.log
2 indicates an error output
1 indicates standard output


>& Specific differences: http://blog.csdn.net/reyleon/article/details/11595985



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.