Why does my crond fails to start?
Posted by lloyd on Tue 19 Oct 2010 at 12:37
Due to a disk crash I've had to rebuild my Debian Lenny system. For some reason I can't get my cron-fired backup scripts to run. They will run manually.
It looks like crond is not running. If I try to start it, here's what I get:
Pancho:/home/lloyd# /etc/init.d/cron start Starting periodic command scheduler: crond failed!
More information:
lloyd@Pancho:~$ /etc/init.d/cron start Starting periodic command scheduler: crond/etc/init.d/cron: line 54: start-stop-daemon: command not found failed!
Yet:
lloyd@Pancho:/sbin$ ls -l start-stop-daemon -rwxr-xr-x 1 root root 24280 2010-03-08 15:54 start-stop-daemon
So, the system can't find start-stop-daemon when I try to start cron from the user account. But, when I add /sbin to user PATH var, I get the same error message as when I try to start from root.
lloyd@Pancho:~$ /etc/init.d/cron start Starting periodic command scheduler: crond failed!
Clearly the problem failure to find start-stop-daemon is not the problem and I'm still in the dark.
Is there a wise wizard in the house who can help me diagnose and solve this problem?
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
Look in the logs in /var/log/messages (or similar) and it will tell you why it's failing :) Also, don't bother trying to run /etc/init.d/* scripts as any user but root, as that's what they'll get run as on startup.
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
What happens if you try to run start-stop-daemon directly?
birthday:~# /sbin/start-stop-daemon /sbin/start-stop-daemon: need one of --start or --stop Try '/sbin/start-stop-daemon --help' for more information.
That is what you should see, but if you don't that might point out a missing library, or an architecture issue. (ie if "file /sbin/start-stop-daemon" shows it is a 64-bit exec and you're running a 32-bit kernel you'll get an exec-format error).
[ Parent | Reply to this comment ]
I have ubuntu here, so I can't give the proper name
of the daemon, but if you let your packagemanager search all
packages which have "cron" in their name, you could find the
one missing.
[ Parent | Reply to this comment ]
2. Run (as root) '/bin/sh -x /etc/init.d/crond start'
3. Go from there
[ Parent | Reply to this comment ]
If this happened after a crash, the most probable cause is that cron is bailing out because it cannot create or read a critical file.
Possible culprits:
/var/run
/var/spool/cron drwxr-xr-x 5 root root
/var/spool/cron/crontabs drwx-wx--T 2 root crontab
...and others. As others already pointed out, check your log files for possible pointers.
[ Parent | Reply to this comment ]
Lets see FBSD 7.1
First scripts simply didn't work which was executed from cron and I got no useful debug logs but eventually I figured out the problem is the broken path variable inside crontab what I fixed up:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/var/log
Then guess what. Randomly after 3 days cron stops executing commands again (crond is running, nothing useful in the log).
[ Parent | Reply to this comment ]
Turns out the problem was much deeper than crond. Shortly after I posted this my system totally froze, couldn't even get a terminal window. I powered down and powered up. When it got to the log-in screen it refused both my user and root credentials.
I rebuilt the system yesterday and cron works a charm.
Thanks again,
LRP
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]