linux:crontab
crontab
Usage
Edit current user's crontab:
crontab -e
List user's crontab:
crontab -l
Rule, verify website: https://crontab.guru/ :
0 0 * * * "command"
The first five fields shall be integer patterns that specify the following:
- Minute [0,59]
- Hour [0,23]
- Day of the month [1,31]
- Month of the year [1,12]
- Day of the week ([0,6] with 0=Sunday)
Symbol:
*
(asterisk) means every xxx, for example, * * * * *
means every minutes;
,
(comma) means or, such as 1,22
means every 1/22 [classifier];
-
(hyphen) means to, such as 1-10
means from 1 to 10 [classifier];
*/
means every x [classifier], */3 [Hour field]
means every 3 hours.
Tips
Remember set envirnment at the begining of the code.
SHELL=/bin/bash LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 0 * * * * /data/backup.sh
linux/crontab.txt · 最后更改: 2023/12/03 10:24 由 127.0.0.1