当前位置:网站首页>Periodic planning work
Periodic planning work
2022-06-30 07:29:00 【My deep blue】
Linux Periodic planning work
cron process
cron: It's a process . It can make linux Execute a command periodically .
crontab It's an order , You can set linux Execute a command periodically .
-u: Set the periodic work of a user --root jurisdiction ;
-e: edit crontab Work content of
-l: Look up crontab Work content of
-r: Remove all crontab Work content of , To remove only one item , please
use -e To edit
- Explanation of sentence format
- Sentence order minute hour day month week command
Sequential column | Means |
---|---|
minute | Represents minutes , It can be from 0 To 59 Any integer between . |
hour | For hours , It can be from 0 To 23 Any integer between . |
day | Means day , It can be from 1 To 31 Any integer between . |
month | Represents the month , It can be from 1 To 12 Any integer between . |
week | Day of the week ,0 To 7 The whole number between ,0 or 7 On behalf of Sunday |
command | Commands to execute , It can be a system command , You can also write your own feet |
- Special symbols
Special symbols | Means |
---|---|
* ( asterisk } | Accept at any time , Represents any time |
, ( comma ) | Stands for separated fields |
- ( minus sign } | For a period of time |
/ n | that n On behalf of the digital , That is, every n Unit interval execution means |
- crontab give an example
Achieve the goal | example |
---|---|
Every time 1 Once per minute | /1 * * * * command |
At the end of every hour 15,30,45 Minute execution | 15,30,45 * * * * command |
7 Point to 10 Point of the first 10、 The first 50 Minute execution | 10,50 7-10 * * * command |
Every other day 7-11 Point of the first 20 And the 40 Minute execution | 20,40 7-11 */ 1 * * command |
On Monday 7 Point to 11 Point of the first 25 And the 50 Minute execution | 25,50 7-11 * * 1 command |
Daily 3:30 perform | 30 3 * * * command |
monthly 1、10、 20 Japanese 3: 30 perform | 30 31,10,20 * * command |
Every Saturday 、 Sunday's 3:30 perform | 30 3 * * 6,7 command |
Every day 9 Point to 16 Every 15 Minute execution | /15 9-16 ** * command |
crontab To configure
- crontab The configuration file
first line SHELL Variable specifies which system to use shell, Here is bash.
The second line PATH Variable specifies the path of the system to execute the command .
The third line MAILTO The variable specifies crond The task execution information of will be sent to root user , If MAILTO The value of the variable is null , The task execution information is not sent to the user .
- crontab Configuration principle
When the user uses crontab This command is used to create a work schedule after , The work will be recorded in /var/spool/cron/ It went to the , And it is judged by the account number
Such as : lewis use User use crontab after , His work will be recorded in /ar/spool/cron/lewis in . in addition ,cron Every operation will be recorded in /var/log/cron In this log file .
- crond service
crond The service detects every minute , therefore cron Will read every minute /etc/crontab And /var/spool/cron The data content inside , therefore , As long as you finish editing /etc/crontab This file , And after storing it , that cron The configuration of will automatically run .
If you have finished modifying crontab Or add crontab There is no immediate implementation , So you can use systemctl restart crond.service restart
边栏推荐
- Experiment 1: comprehensive experiment [process on]
- 网络安全-单臂路由、DHCP中继和ICMP协议
- C language implementation sequence stack
- MCU essay
- Utilisation de la commande grep
- 单测调用对象的私有方法
- Resolution: div failed to get keyboard event
- QT msvc2015 compiler reports an error: error: lnk1158: unable to run "rc.exe"
- [solved] failed! Error: Unknown error 1130
- 期末複習-PHP學習筆記6-字符串處理
猜你喜欢
Pit stepping record: Supervisor log return information: redis extension is not installed
Resolution: div failed to get keyboard event
Halcon: read the camera and binary it
Application of stack -- using stack to realize bracket matching (C language implementation)
The maximum expression in Oracle database message list is 1000 error
Stm32g0 Tim interrupt use
Sublime text 3 configuring the C language running environment
期末复习-PHP学习笔记9-PHP会话控制
The first up Master of station B paid to watch the video still came! Price "Persuading" netizens
Implementation of double linked list in C language
随机推荐
网络安全-VLAN和Tunk方法详解
Lt268 the most convenient TFT-LCD serial port screen chip in the whole network
大学刚毕业不知道做什么工作怎么办?
TC397 QSPI(CPU)
Stepper motor
Adjacency matrix representation of weighted undirected graph (implemented in C language)
El input can only input numbers and has a decimal point. At most two digits can be reserved
手机开户股票开户安全吗?开户需要准备什么?
Can introduction
failed to create symbolic link ‘/usr/bin/mysql’: File exists
网络安全-路由原理
Test enumeration types with STM32 platform running RT thread
How to batch modify packaging for DXP schematic diagram
期末复习-PHP学习笔记9-PHP会话控制
Embedded test process
DXP shortcut key
线程池——C语言
Binary tree traversal
Pit stepping record: Supervisor log return information: redis extension is not installed
How to use string branches for switch case