crontab定时任务设置
可以通过crontab设置程序的执行时间
列出定时任务:crontab -l
编辑定时任务:crontab -e
删除定时任务:crontab -d
设置定时任务的格式是:
分钟 小时 天 月 星期 脚本
例如:
设定每天的6点执行hello.sh
* 6 * * * /path/hello.sh
设定每5分钟执行一次hello.sh
*/5 * * * * /path/hello.sh
设定每个星期六晚11点执行hello.sh
* 23 * * 6 /path/hello.sh
注:分钟(0~59),小时(0~23),天(1~31),月(1~12),星期(0~6,0代表星期日)