当前位置:网站首页>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
边栏推荐
- Introduction to ecostruxure (1) IEC61499 new scheme
- Use of ecostruxure (2) IEC61499 to establish function blocks
- Desk lamp control panel - brightness adjustment timer
- ADC basic concepts
- Proteus catalog component names and Chinese English cross reference
- Introduction to go project directory structure
- failed to create symbolic link ‘/usr/bin/mysql’: File exists
- 将本地电脑文件复制到虚拟机系统中详细方法
- Label the picture below the uniapp picture
- Assembly learning register
猜你喜欢

Cubemx completes STM32F103 dual serial port 485 transceiver transmission

Halcon: read the camera and binary it

Go common commands

Final review -php learning notes 11-php-pdo database abstraction layer

网络安全-ARP协议和防御

All errors reported by NPM

Thread pool - C language

Qtcreator debug code after configuring CDB debugger view variable value display card

Video player (I): process

Record the problem that the system file cannot be modified as an administrator during the development process
随机推荐
STM32 infrared communication 3 brief
QT wmic command obtains some hardware information
年轻人搞副业有多疯狂:月薪3000,副业收入3W
Utilisation de la commande grep
What if I don't know what to do after graduating from university?
Experiment 1: comprehensive experiment [process on]
The first up Master of station B paid to watch the video still came! Price "Persuading" netizens
网络安全-单臂路由、DHCP中继和ICMP协议
Go common commands
02 - bare metal and RTOS development modes: five development modes of bare metal and the introduction of RTOS
DS1302 digital tube clock
QT elementary notes
How to use string branches for switch case
Video player (I): process
神经网络计算量及参数量
LabVIEW程序代码更新缓慢
大学刚毕业不知道做什么工作怎么办?
模拟接口没声明异常抛出异常
How to batch modify packaging for DXP schematic diagram
Variable storage unit and pointer