CentOS中的Crontab是一个用于定时执行任务的工具。它的基本语法格式如下:
* * * * * command-to-be-executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)
每个字段可以包含以下值:
以下是一些Crontab示例:
0 1 * * * /path/to/command
15 * * * * /path/to/command
0 10 * * 1-5 /path/to/command
0 15 1,15 * * /path/to/command
要编辑Crontab文件,请在终端中输入crontab -e命令。要查看当前用户的Crontab列表,请输入crontab -l命令。