之前一直用的是Centos 6,最近换上了Centos 7,发现和Centos 7的常见使用有不少差别,原来的命令很多都失效了,这里VPS评测与排名站将常用的crontab命令对比下,方便大家使用。
开启crontab
/bin/systemctl start crond.service
之前的版本如下
/sbin/service crond start
停止crontab
/bin/systemctl stop crond.service
之前的版本如下
/sbin/service crond stop
重启crontab
/bin/systemctl restart crond.service
之前的版本如下
/sbin/service crond restart
重载
/bin/systemctl reload crond.service
之前的版本如下
/sbin/service crond stop reload
查询状态
/bin/systemctl status crond.service
之前的版本如下
/sbin/service crond status
可能有些系统的 crontab的的日志默认是关闭的,所以我们要把它开启
1. 打开rsyslog
/etc/init.d/rsyslog start
2. 查看日志
tail /var/log/cron