当我安排工作时,似乎有些立即被应用,而另一些重启之后。因此,建议添加新的cron作业后重新启动cron
(crond
)吗?如何正确地做到这一点(尤其是在Debian系统中),即使是普通用户也应该这样做sudo
(例如sudo service cron restart
)?
我试过了:
/etc/init.d/cron restart
似乎不起作用(/etc/init.d/cron stop
或都不起作用service cron stop
),并以返回码1结束。
这是消息输出的一部分:
由于您尝试调用的脚本已转换为Upstart作业,因此您也可以使用stop(8)实用程序,例如stop cron stop:拒绝发送消息,1条匹配的规则;type =“ method_call”,sender =“:1.91”(uid = 1000 pid = 3647 comm =“ stop cron”)interface =“ com.ubuntu.Upstart0_6.Job” member =“ Stop” error name =“(unset)” request_reply =“ 0” destination =“ com.ubuntu.Upstart”(uid = 0 pid = 1 comm =“ / sbin / init”)
(那是什么意思?)
不,您不必重新启动cron
,它会注意到您的crontab文件(/etc/crontab
或用户crontab文件)的更改。
您可能在/ etc / crontab的顶部(如果您拥有cron
IIRC的Vixie实现是Debian上的实现):
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
您可能看不到已实施的特定更改的原因是,如果您将内容添加到例如中,/etc/cron.daily
并且已经开始进行日常运行。
您收到的消息是因为您使用了一种重新启动系统上的cron的旧方法。推荐的方式(但如果您仅编辑cron文件则不是必需的)是:
restart cron
当然,您必须重新启动才能查看@reboot cron作业的效果
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句