20190923-11Linux crond system timing tasks 000 019

crond Service Management

1 . Re- start the crond service

[root@hadoop101 ~]# service crond restart

centOS7是 systemctl restart crond

 

crontab scheduled tasks set

1. The basic syntax

crontab [ options ]

2 . Option Description

Table 1-46

Options

Features

-e

Edit crontab regular tasks

-l

Query crontab task

-r

Delete all the current user's crontab tasks

3. Parameter Description

[root@hadoop101 ~]# crontab -e

( 1 ) into the crontab editing interface. It will open vim to edit your work.

* * * * * Task execution

Table 1-47

project  

meaning  

range

The first " * "

Among the first few minutes of one hour

0-59

The second " * "

The first few hours of the day

0-23

The third " * "

The first day of the month among the

1-31

The fourth " * "

The first few months of the year

1-12

The fifth " * "

The week of the week

0-7 ( 0 and 7 represent Sunday)

( 2 ) special symbols

Table 1-48

Special symbols

meaning

*

Representatives at any time. For example, the first " * " represents one hour are executed once meant every minute.

On behalf of discontinuous time. For example, " 0 8,12,16 * * * Commands", on behalf of the daily 8 Dian 0 points, 12 Dian 0 points, 16 Dian 0 Fen command is executed once

-

It represents the continuous time frame. For example, " 05 * * 1-6 command" on behalf of Monday to Saturday morning 5 Dian 0 execute command points

*/n

Representative of how often executed once. Such as " * / 10 * * * *   Commands", on behalf of every 10 minutes to execute the command again

( 3 ) specific command execution time

Table 1-49

time  

meaning

4522 * * * command

At 22 is point 45 Run minutes

* 017 * 1 command

Week 1 of . 17 point 0 different executive command

05 1,15 * * command

Monthly 1 numbers and 15 numbers Lingchen 5 Dian 0 different executive order

404 * * 1-5 Command

Monday to Friday morning 4 Dian 40 different executive order

* / 104 * * * command

Daily morning . 4 points every 10 minutes to perform a command

0 0 1,15 * 1 command

Monthly 1 numbers and 15 numbers, each week 1 of 0 Dian 0 Fen will execute the command. Note: The day of the week and number of several best not to appear because they are defined in days. Very easy for administrators to confusion.

4. Case practical operation

( 1 ) every 1 minute /root/bailongma.txt to add a file 1 the number 1

*/1 * * * * /bin/echo ”11” >> /root/bailongma.txt

 

Guess you like

Origin www.cnblogs.com/YUJIE666/p/11570204.html