Linux VPS Planning Task crond command usage sharing _linux

Source: Internet
Author: User
First, the Installation plan task
This program may not be pre-installed on some systems, and you will need to perform the following command to install it.

Yum Install-y Vixie-cron

Then start the service

Service Crond Start

Second, set up scheduled Tasks
(1) Execute the following command to set up a scheduled task:

Crontab-e

The reason to use the above command instead of using VI directly is because Cron has a few but very necessary syntax checks.
(2) Set the specification of the scheduled task:
T1 T2 T3 T4 T5 Program

T1 represents minutes,
T2 says the hour,
T3 represents the day ordinal of a month,
T4 represents the month,
T5 represents the first day of the one week.
Program represents the programs to be executed.
(3) Some examples:
Perform a/bin/ls every 0 minutes per day of the month:

0 * * * */BIN/LS

In December, every 6 to 12 o ' Day in the morning, every 20 minutes to perform a/usr/bin/backup:

*/20 6-12 */usr/bin/backup

Send a letter to Alex@domain.name from Monday to Friday every 5:00:

0 * * 1-5 mail-s "HI" Alex@domain.name </tmp/maildata

Every day at midnight 0:20, 2:20, 4:20 ... execute echo "haha"

0-23/2 * * * echo "haha"

Every two hours between 11 o'clock and 8 in the morning, and at eight a.m. in the morning, executes the date command.

0 23-7/2,8 * * * Date

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.