Analysis on crontab Task Scheduling in Linux

  • 2021-07-09 09:38:07
  • OfStack

1. Create a scheduling task

Instruction

crontab-e Enter current user editing interface

crontab-u User Name-e Enter Specified User Editing Interface

Enter the crontab task editing interface

Task writing format

# Perform a view of the/ect directory once per minute and write the contents of the/tml/a. txt

*/ 1 * * * * ll /etc > > /tmp/a.text

# crontab Object + Directive

# Multiple tasks performed simultaneously
# crontab Object Directive 1 & Directive 2

crontab Object Parameters

The first * indicates the minute range 0-59

The second * indicates the hour range: 0-23

The third * indicates the range of days: 1-31

The 4th * indicates the month range: 1-12

The fifth * indicates the day of the week range: 0-7 (both 0 and 7 mean weekends)

Meaning of Special Symbols in crontab Objects

* Indicates any time

Represents multiple time points such as 1, 2 * * * * means that 1 and 2 points are executed every day

-It means that the time is a closed interval

*/How often does N represent execution

STEP 2 View Tasks

crontab-l View Tasks under Current User

crontab-u User Name-l View Tasks under Specified User

3. Delete tasks

crontab-r Delete task under current user

crontab-u Username-r Delete task under specified user

Summarize


Related articles: