Detailed explanation of Cron usage in Unix and Linux operating systems

Source: Internet
Author: User
Sbinservicecrondstart start service sbinservicecrondstop disable service sbinservicecrondrestart restart service sbinservic

/Sbin/service crond start // start the service

/Sbin/service crond stop // close the service

/Sbin/service crond restart // restart the service

/Sbin/service crond reload // reload the configuration

This service can be automatically started when the system is started:

Add:

/Sbin/service crond start

1. directly use the crontab command to edit

The cron service provides the crontab command to set the cron service. The following are some parameters and descriptions of this command:

Crontab-u // set a user's cron service. Generally, the root user needs this parameter when executing this command.

Crontab-l // list the details of a user's cron service

Crontab-r // delete the cron service of no user

Crontab-e // edit a user's cron service

For example, to view your cron settings as root:

Crontab-u root-l

For example, root wants to delete fred's cron settings:

Crontab-u fred-r

When editing the cron service, the edited content has some formats and conventions. enter:

Reference:Crontab-u root-e

In the vi editing mode, the edited content must conform to the following format:

*/1 ***** ls>/tmp/ls.txt

The first part of this format is the time setting, and the last part is the command to be executed. if there are too many commands to be executed, you can write these commands into a script, then you can directly call this script here. remember to write the complete path of the command during the call. We have a certain agreement on the time setting. the first five * numbers represent five numbers. the value range and meaning of the numbers are as follows:

Reference:

Minutes (0-59)

Hour (0-23)

Date (1-31)

Month (1-12)

Week (0-6) // 0 represents 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.