一:常用命令
yum install crontabs
安装
service crond start
开启服务
service crond stop
关闭服务
service crond restart
重启服务
service crond reload
重新载入配置
service crond status
查看服务状态
crontab [-u user] file
用指定的文件替代目前的crontab
crontab [-u user] -l
列出用户目前的crontab
crontab [-u user] -e
编辑用户的crontab
crontab [-u user] -r
删除用户的crontab
二:crontab时间格式
几分 | 几点 | 几号 | 几月 | 星期几 | 执行命令 |
---|---|---|---|---|---|
* | * | * | * | * | command |
取值范围:0-59 | 取值范围:0-23 | 取值范围:1-31 | 取值范围:1-12 | 取值范围:0-7 | sh test.sh |
运算符 | "/ "频率 |
"- "范围 |
", "且(and) |
如果全部为* 则表示每分钟 |
php test.php |
三:crontab日志
Linux查看路径:/var/log/cron
Mac查看路径:/var/mail/augus
网友评论