当前位置:网站首页>Cron expression use
Cron expression use
2022-07-27 16:24:00 【Tony-devj】
Cron Expressions use
Planning tasks , It's a task to carry out the planned work at the appointed time , This is the surface meaning . stay Linux in , We often use cron Server to do this .cron The server can perform specific tasks according to the time agreed in the configuration file .
Introduce
One cron The expression is made up of 6~7 Composed of domains , And a space delimited string .cron It turned out to be unix One of the tools in . It is mainly used for scheduling tasks .cron The core use is cron Expression to handle task scheduling .
Domain explanation
A complete cron The expression has a total of 7 Domains , From left to right means seconds 、 branch 、 Hours 、 Date in month 、 month 、 Date of the week 、 year
The year item is optional , Not necessarily , Therefore, generally, the year is not written for the scheduled task , This is the 6 position .
cron Relevant symbols and uses
- ﹡: Allow this field to use all values
- ?: Only allowed in 4 Domains ( Date in month ) And the 6 Domains ( Date of the week ), Indicates that the value of this field is not considered , Because the data in the two domains may conflict
- -: This symbol identifies the range
- ,: This symbol represents multiple values in a field in parallel
- /: This symbol sets the step size
- L: Said the last
- W: It means week 1 By the end of the week 5, This symbol can only appear in 4 Fields and can only be combined with other values
- #: This symbol can only appear in 6 In a domain ( Date of the week ), Indicates the day of the month
stay Linux The use of
stay linux Use in crontab Command to operate cron, The code is as follows :
man crontab # see crontab Help document for

View the set scheduled tasks
crontab -l

have access to man Help documents to learn crontab command .
stay spring Use in
In normal development , Need to write scheduled tasks , We can use spring Of @Scheduled annotation , Set up a cron Set the value of .
@Scheduled(cron="10 * * * * ?")
public void scheduledTask(){
/****do somethings***/
}
边栏推荐
- Draw circuit diagram according to Verilog code
- Multiline text overflow dotting
- mysql设置密码时报错 Your password does not satisfy the current policy requirements(修改·mysql密码策略设置简单密码)
- Oracle 常用语句
- Flume incrementally collects MySQL data to Kafka
- Example of the task submitted by the Flink packer
- 2.2 basic elements of JMeter
- DRF learning notes (IV): DRF view
- Busybox login: can't execute'/bin/bash': no such file or directory solution
- __ The difference between typeof and typeof
猜你喜欢

webRTC中的coturn服务安装

文本截取图片(哪吒之魔童降世壁纸)

编码技巧——全局异常捕获&统一的返回体&业务异常

JSP Foundation

Flask connects to existing tables in MySQL database

Characters generated by JMeter function assistant in jmeter5.3 and later versions cannot be copied when they are grayed out

Common tool classes under JUC package

Content ambiguity occurs when using transform:translate()

Web test learning notes 01

Boolean value
随机推荐
2.2 JMeter基本元件
Vant UI toast and dialog use
Servlet basic knowledge points
实现浅拷贝和深拷贝+
Paper_ Book
Delete node quickly and efficiently_ modules
Simulation生成报表
Easy to understand, distinguish between ++i and I++
training on multiple GPUs pytorch
It can carry 100 people! Musk releases the strongest "starship" in history! Go to Mars as early as next year!
TP5 -- query field contains a certain --find of search criteria_ IN_ SET
Determine the exact type of data
DRF learning notes (V): viewset
Axure 安装图标字体元件库
Draw circuit diagram according to Verilog code
DeFi安全之DEX与AMMs
Solve the problem that Flink cannot be closed normally after startup
C channel simply implements the publishing and subscription of message queue
Analysis of PHP keyword replacement classes (avoid repeated replacement, keep and restore the original links)
Openwrt adds support for SD card