在Linux中,Crontab是一个用于设置周期性被执行的任务的工具
* * * * * command-to-be-executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday to Saturday; 7 is also Sunday)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)
以下是一些Crontab时间格式的示例:
* * * * * /path/to/command
0 1 * * * /path/to/command
0 1 1 * * /path/to/command
0 1 * * 0 /path/to/command
0 1 1 1 * /path/to/command
注意:在Crontab中,你可以使用特殊字符,如*(表示任意值)、,``(表示枚举值)、-(表示范围)和/(表示间隔)。例如,*/15 * * * *`表示每15分钟执行一次命令。