Cron study notes

Source: Internet
Author: User
In cronlinux, the server that runs the scheduled task executes the specific task according to the time specified in the configuration file. Cron (ubuntu) startup service servicecronstart close service servicecronstop restart service servicecronrestart re-load configuration service...

 

In cron linux, the server that runs the scheduled task executes the specific task according to the time specified in the configuration file.

 

Cron (ubuntu)

 

 

Start service cron start

 

Disable service cron stop

 

Restart service cron restart

 

Reload and configure service cron reload

 

 

 

 

There are two methods to configure cron:

 

1. use the crontab command

 

-U is the specified user

 

 

-E: edit your cron service

 

-L list users' cron services

 

-R: deletes the user's cron service.

 

For example, crontab-u root-e is used to edit the cron task of the root user.

 

 

After entering the editing mode

 

Display: # m h dom mon dow command

 

M indicates minute (0-59)

 

H indicates the hour (0-23)

 

Dom indicates the date (1-31)

 

Mon indicates the month (1-12)

 

Dow indicates that the week (0-6) 0 is Sunday

 

For example:

 

30 16 *** echo "Take care of yourself !" >/Dev/null

 

 

At 04:30, run echo "Take care of yourself !"

 

 

 

 

2. modify the/etc/crontab file

 

Vim is displayed

 

# M h dom mon dow user command

 

User

 

For example: 01 **** root run-parts/etc/cron. hourly

 

 

Execute scripts in/etc/cron. hourly every hour

 

Run-parts indicates executing scripts in the folder.

 

Run-parts can be removed and script commands can be directly added.

 

 

The other method is the same as the first method.

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.