在Debian系统中,Crontab的时间表达式由5个字段组成,分别表示分钟、小时、日期、月份和星期。每个字段的取值范围如下:
时间表达式的格式为:
* * * * * command-to-be-executed
- - - - -
| | | | |
| | | | ----- 星期
| | | ------- 月份
| | --------- 日期
| ----------- 小时
------------- 分钟
以下是一些示例:
0 1 * * * /path/to/command
0 10 * * 0 /path/to/command
0 15 1 * * /path/to/command
0 9-17 * * 1-5 /path/to/command
注意:在Crontab中,特殊字符如*、,、-和/可以用来表示时间范围、列表和间隔。例如,*/30表示每30分钟,1,2,3表示在第1、2和3分钟。