Chapter 11: Scheduled Task Scheduling

11.1: Task Scheduling

crontab to set up scheduled tasks

Overview

        Task scheduling: refers to specific commands or programs executed by the system at a certain time

Task scheduling classification:

1: System work: Some important work must be performed repeatedly

2: Individual user work: Individual users may want to execute certain programs

Basic syntax:

crontab [options]

​ Commonly used options

-E Edit CRONTAB scheduled tasks
-l Query crontab tasks
-r Delete all crontab tasks for the current user
11.2: Getting Started

Parameter details: description of 5 placeholders

project meaning scope
First"*" Minute of the hour 0~59
the second"*" hour of day 0~23
The third"*" What day of the month is it? 1~31
the fourth"*" Which month of the year 1~12
the fifth"*" day of the week 0~7 (0 and 7 both represent Sunday)
special symbols meaning
* Represents any time.
, Represents discontinuous time. For example, "0 8,12,16 * * *Command": means that the command will be executed at eight o'clock, twelve o'clock, and sixteen o'clock every day.
- Represents a continuous time range. For example, "0 5 * * 1-6 command": means executing the command at 5 a.m. from Monday to Saturday
*/n Represents how often it is executed

eg: 0 0 1,15 * 1 command: on the 1st and 15th of every month, the command will be executed every Monday at 0:00

Note: It is best not to have confusion about the day of the week and the day of the week at the same time, because they define both days, which is very easy for the administrator to

11.3: crond related instructions

crontab -r: Terminate task scheduling

crontab -l: List the currently scheduled tasks

service crond restart [restart task scheduling]

11.4: at scheduled task

 

 

 

Guess you like

Origin blog.csdn.net/weixin_63925896/article/details/132158737