当前位置:网站首页>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
边栏推荐
- Error reporting record
- Desk lamp control panel - brightness adjustment timer
- STM32 register on LED
- Network security - routing principle
- STM32 infrared communication 3 brief
- The class imported by idea import clearly exists, but it is red?
- Pool de Threads - langage C
- Keil serial port redirection
- 网络安全-ARP协议和防御
- Thread pool - C language
猜你喜欢

The maximum expression in Oracle database message list is 1000 error

Pool de Threads - langage C

C language implementation sequence stack

線程池——C語言

Video player (II): video decoding

Use of ecostruxure (2) IEC61499 to establish function blocks

Raspberry pie 4B Getting Started Guide

The most convenient serial port screen chip scheme designed at the charging pile in China

Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)

What if I don't know what to do after graduating from university?
随机推荐
期末複習-PHP學習筆記6-字符串處理
Introduction to go project directory structure
网络安全-路由原理
Is it safe to open a stock account by mobile phone? What do I need to prepare for opening an account?
Swiftui creates a beautiful custom press feedback button
4diac getting started example
grep命令用法
Resolution: div failed to get keyboard event
Network security - single arm routing, DHCP relay and ICMP Protocol
Graphic explanation pads update PCB design basic operation
MAX6675 usage notes
Grep command usage
Connection flood attack principle
Thread pool - C language
Introduction to go language pointer
1、 Output debugging information: makefile file debugging information $(warning "tests" $(mkfile\u path)); makefile file path
LabVIEW程序代码更新缓慢
Qtcreator debug code after configuring CDB debugger view variable value display card
1285_ Expand macros defined by AUTOSAR functions and variables with scripts to improve readability
Video player (I): process