Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Linux VPS scheduling tasks how to use the crond command

Shulou Source: shulou.com Published: 2022-05-31 12:05:28 10月14日 Update

In this article, the editor introduces in detail the "Linux VPS planning task crond command how to use", the content is detailed, the steps are clear, and the details are handled properly. I hope that this "Linux VPS planning task crond command how to use" article can help you solve your doubts, following the editor's ideas slowly in depth, together to learn new knowledge.

First, installation planning tasks

This program may not be preinstalled on some systems and needs to be installed by executing the following command.

Yum install-y vixie-cron

Then start the service

Service crond start

Second, set up scheduled tasks

(1) execute the following command to set the scheduled task:

Crontab-e

The reason for using the above command rather than directly using vi is that cron does a small but necessary syntax check.

(2) set the specification for scheduled tasks:

T1 t2 t3 t4 t5 program

T1 means minutes.

T2 represents hours.

T3 indicates the day of a month.

T4 represents the month

T5 represents the day ordinal of a week.

Program represents the program to run.

(3) some examples:

Execute / bin/ls once a month at the 0th minute of every hour:

0 * / bin/ls

/ usr/bin/backup is performed every 20 minutes from 6 a.m. to 12:00 every December:

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

Send a letter to alex@domain.name at 5:00 every day from Monday to Friday:

0 17 * * 1-5 mail-s "hi" alex@domain.name < / tmp/maildata

00:20, 02:20, 04:20 every day of the month. . Execute echo ""

200-23max 2 * echo ""

The date command is executed every two hours between 11:00 and 8am, and at 8am.

023-7bat 2pm 8 * date

After reading this, the article "how to use crond commands for Linux VPS Planning tasks" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, welcome to follow the industry information channel.

Tags: Task order hour article face content month point proper necessary two number few reason between ideas new knowledge week more steps Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Docker Xiaomi Huawei MariaDB