Cron进程没有启动

我有一个用cron作业创build的ec2映像。

这些工作无法运行; 我发现cron进程本身还没有开始。 所以,我在/etc/rc.d/rc.local中包含/ usr / sbin / cron并创build了另一个映像。 但由于某些原因,cron进程不能在启动时启动。

如果我重新启动机器,cron进程运行。 它启动时不运行!

为什么会发生这种情况? 另外,有没有其他的select呢?

在/ var / log / syslog中没有看到任何cron日志条目吗?

 # grep cron /var/log/syslog* <grep output here> 

无论如何,也许cron被禁用。 确保它没有实际运行:

 # status cron cron start/running, process 1103 

如果该命令的输出是cron stop/waiting ,那么确保你的/etc/init/cron.conf文件存在并且是正确的(应该是)。 这里是我的11.04(10.04相同)框中的内容:

 # cron - regular background program processing daemon # # cron is a standard UNIX program that runs user-specified programs at # periodic scheduled times description "regular background program processing daemon" start on runlevel [2345] stop on runlevel [!2345] expect fork respawn exec cron 

如果一切看起来都不错,尝试用start cron启动守护进程。

否则,如果一切都失败了,你可以尝试在/var/log/*寻找cron错误。

确保目录/etc/rc.d/init.d (或者ubuntu的/etc/init.d )有crond

如果不是的话,这里是我们的(开源)GNU / Linux开箱即用的。 (抱歉,很长的post,但不是那么长):

 #! /bin/bash # # crond Start/Stop the cron clock daemon. # # chkconfig: 2345 90 60 # description: cron is a standard UNIX program that runs user-specified \ # programs at periodic scheduled times. vixie cron adds a \ # number of features to the basic UNIX cron, including better \ # security and more powerful configuration options. # processname: crond # config: /etc/crontab # pidfile: /var/run/crond.pid # Source function library. . /etc/init.d/functions . /etc/sysconfig/crond t=${CRON_VALIDATE_MAILRCPTS:-UNSET} [ "$t" != "UNSET" ] && export CRON_VALIDATE_MAILRCPTS="$t" # See how we were called. prog="crond" start() { echo -n $"Starting $prog: " if [ -e /var/lock/subsys/crond ]; then if [ -e /var/run/crond.pid ] && [ -e /proc/`cat /var/run/crond.pid` ]; then echo -n $"cannot start crond: crond is already running."; failure $"cannot start crond: crond already running."; echo return 1 fi fi daemon crond $CRONDARGS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crond; return $RETVAL } stop() { echo -n $"Stopping $prog: " if [ ! -e /var/lock/subsys/crond ]; then echo -n $"cannot stop crond: crond is not running." failure $"cannot stop crond: crond is not running." echo return 1; fi killproc crond RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/crond; return $RETVAL } rhstatus() { status crond } restart() { stop start } reload() { echo -n $"Reloading cron daemon configuration: " killproc crond -HUP RETVAL=$? echo return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; status) rhstatus ;; condrestart) [ -f /var/lock/subsys/crond ] && restart || : ;; *) echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}" exit 1 esac