在 CentOS 系统中,Crontab 的时间表达式由五个字段组成,分别表示分钟、小时、日期、月份和星期。每个字段的取值范围如下:
每个字段可以使用以下符号:
以下是一些示例:
0 2 * * * /path/to/script.sh
0 10 * * 1-5 /path/to/script.sh
0 15 1,15 * * /path/to/script.sh
15 * * * * /path/to/script.sh
要编辑 Crontab 文件,请在终端中输入 crontab -e 命令。在编辑器中添加或修改时间表达式和要执行的脚本,然后保存并退出。