阅读量:2
在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
- 每天凌晨1点执行命令:
0 1 * * * /path/to/command
- 每月1号凌晨1点执行命令:
0 1 1 * * /path/to/command
- 每周日凌晨1点执行命令:
0 1 * * 0 /path/to/command
- 每年1月1日凌晨1点执行命令:
0 1 1 1 * /path/to/command
注意:在Crontab中,你可以使用特殊字符,如*(表示任意值)、,``(表示枚举值)、-(表示范围)和/(表示间隔)。例如,*/15 * * * *`表示每15分钟执行一次命令。
以上就是关于“Linux Crontab时间格式怎样正确书写”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm