例子:
| 描述 | 表达式 | 
|---|---|
| 每五分钟执行 | /5 * * * | 
| 每小时执行 | 0 * * * * | 
| 每天执行 | 0 0 * * * | 
| 每周执行 | 0 0 * * 0 | 
| 每月执行 | 0 0 1 * * | 
| 每年执行 | 0 0 1 1 * | 
格式:分 时 日 月 星期 要运行的命令
创建crontab文件如下:每隔2min打印当前时间
*/2 * * * * /bin/echo `date` test2 >> /Users/XXX/crontab/output添加crontab文件:crontab file
显示crontab任务:crontab -l
编辑crontab: crontab -e
删除crontab文件(不要轻易运行):crontab -r
原文:https://www.cnblogs.com/amyzhu/p/11478619.html