当前位置:网站首页>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
边栏推荐
- Network security - packet capture and IP packet header analysis
- Local unloading traffic of 5g application
- Next initializesecuritycontext failed: unknown error (0x80092012) - the revocation function cannot check whether the certificate is revoked.
- 期末複習-PHP學習筆記6-字符串處理
- Variable storage unit and pointer
- 1.someip introduction
- Introduction to go language pointer
- Final review -php learning notes 11-php-pdo database abstraction layer
- 嵌入式测试流程
- Parameter calculation of deep learning convolution neural network
猜你喜欢
Assembly learning register
Can introduction
Resolution: div failed to get keyboard event
视频播放器(一):流程
Basic knowledge of system software development
MySQL encounters the problem of expression 1 of select list is not in group by claim and contains nonaggre
The class imported by idea import clearly exists, but it is red?
How to use string branches for switch case
Examen final - notes d'apprentissage PHP 6 - traitement des chaînes
03 - programming framework: Division of application layer, middle layer and driver layer in bare metal programming
随机推荐
套接字socket编程——UDP
線程池——C語言
grep命令用法
01 - embedded learning route and career planning: embedded basic knowledge and development process
El input can only input numbers and has a decimal point. At most two digits can be reserved
Calculation and parameter quantity of neural network
Stm32g0 and FreeRTOS learning summary
视频播放器(二):视频解码
Final review -php learning notes 9-php session control
Examen final - notes d'apprentissage PHP 6 - traitement des chaînes
String application -- string violent matching (implemented in C language)
Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)
I graduated this year, but I don't know what I want to do
Proteus catalog component names and Chinese English cross reference table
1、 Output debugging information: makefile file debugging information $(warning "tests" $(mkfile\u path)); makefile file path
期末复习-PHP学习笔记9-PHP会话控制
Double click the idea to solve the problem of downloading again
[solved] failed! Error: Unknown error 1130
将本地电脑文件复制到虚拟机系统中详细方法
Network security - routing principle