Installing and using crontab in CentOS

Source: Internet
Author: User
Installing and using crontab in CentOS

Install crontab in CentOS:

?
1 Yuminstallcrontabs

Start or close this service:

?
1234567 /Sbin/servicecrond start // start the service/sbin/servicecrond stop // close the service/sbin/servicecrond restart // restart the service/sbin/servicecrond reload // reload the configuration

View the crontab Service Status:

?
1 Service crond status

Start the crontab service manually:

?
1 Service crond start

Run the following command to check whether the crontab service is set to start at startup:

?
1 Ntsysv

Add boot auto start:

?
1 Chkconfig -- level 35 crond on

Crontab command:

?
1234 Crontab [-u <用户名称> ] [Configuration file] or crontab [-u <用户名称> ] [-Elr] crontab-u root-e // edit the root timer settings. Crontab-u root-l // list the root timer settings. Crontab-u root-r // delete the root timer settings.

The configuration file format is as follows:

Minute Hour Day Month DayOFWeek Command

* *** Command
Hour, day, month, and Week commands

The 1st column indicates minute 1 ~ 59. each minute is represented by * or */1.
The first column indicates the hour 1 ~ 23 (0 indicates 0 points)
The 3rd column indicates the date 1 ~ 31
The 4th column indicates the month 1 ~ 12
The identification number of column 5th is from day of the week to day ~ 6 (0 indicates Sunday)
6th columns of commands to run

?
123 40 23 ***/usr/bin/php/var/www/html/. php // execute 40, 20 **/usr/bin/php/var/www/html/a at every day. php // execute 40 ***,/usr/bin/php/var/www/html/a at every month. php // Run on Saturday at on Sunday
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: 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.