Crontab in linux

Source: Internet
Author: User
On linux servers, the crontab command is often used to set automatically executed tasks.
The general setting method is as follows:

*/10 * root/usr/local/php/bin/php/data/list. php

Below are some online materials:

Crontab format:
1st columns minute 1 ~ 59
2nd columns hour 1 ~ 23 (0 indicates midnight)
1-3rd ~ 31
4th columns Month 1 ~ 12
5th columns in a week 0 ~ 6 (0 indicates Sunday)
6th columns of commands to run

The following is the crontab format:
Command to be run by hour, day, month, and week

Here are some examples of crontab file entries:

30 21 ***/usr/local/apache/bin/apachectl restart
The preceding example indicates restarting apache at every night.

45 4, 22 **/usr/local/apache/bin/apachectl restart
The preceding example indicates that apache is restarted at on the 1st, 10th, and 22th every month.

10 1 ** 6, 0/usr/local/apache/bin/apachectl restart
The preceding example indicates that apache is restarted at every Saturday and Sunday.

0, 30 18-23 ***/usr/local/apache/bin/apachectl restart
The preceding example indicates that apache is restarted every 30 minutes between and every day.

0 23 ** 6/usr/local/apache/bin/apachectl restart
The preceding example indicates that apache is restarted at every Saturday.

**/1 ***/usr/local/apache/bin/apachectl restart
Restart apache every hour

* 23-7/1 ***/usr/local/apache/bin/apachectl restart
Restart apache every hour between PM and PM.

0 11 4 * mon-wed/usr/local/apache/bin/apachectl restart
Restart apache on November 4 and every Monday to Wednesday.

0 4 1 jan */usr/local/apache/bin/apachectl restart
Restart apache at on January 1, January 1

Write it here as a record.

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.