用户工具

站点工具


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:

  1. Minute [0,59]
  2. Hour [0,23]
  3. Day of the month [1,31]
  4. Month of the year [1,12]
  5. 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.1534904057.txt.gz · 最后更改: 2023/12/03 10:24 (外部编辑)