New User? Register here - Existing Users: Username: Password: [Advanced Login]

 

 

Current Poll

What language for system administration do you use ?







( 608 votes ~ 1 comments )

 

Why does my crond fails to start?

Posted by lloyd on Tue 19 Oct 2010 at 12:37

Tags: ,

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?

Share/Save/Bookmark


Posted by Anonymous (152.62.xx.xx) on Tue 19 Oct 2010 at 13:10
Your should run "/etc/init.d/cron start" with root privileges. use 'sudo' or 'su'

[ Parent | Reply to this comment ]

Posted by Anonymous (195.26.xx.xx) on Tue 19 Oct 2010 at 16:01
start-stop-daemon is in /sbin, which isn't in the path unless you are root, so not being root when you try and run the /etc/init.d/cron script is likely the cause of this error.

[ Parent | Reply to this comment ]

Posted by Anonymous (195.26.xx.xx) on Tue 19 Oct 2010 at 16:03
[replying to own comment after actually reading the whole post and seeing that you're already looking in /sbin, running as root etc]

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 ]

Posted by Steve (2001:0xx:0xx:0xxx:0xxx:0xxx:xx) on Tue 19 Oct 2010 at 13:37
[ 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).

Steve

[ Parent | Reply to this comment ]

Posted by Anonymous (92.65.xx.xx) on Tue 19 Oct 2010 at 13:59
I think you may miss the daemon.
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 ]

Posted by Anonymous (91.189.xx.xx) on Tue 19 Oct 2010 at 14:26
1. Check the syslog/messages files
2. Run (as root) '/bin/sh -x /etc/init.d/crond start'
3. Go from there

[ Parent | Reply to this comment ]

Posted by Anonymous (83.65.xx.xx) on Tue 19 Oct 2010 at 18:35
(one of the cron Maintainers here)

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 ]

Posted by Anonymous (91.83.xx.xx) on Wed 20 Oct 2010 at 14:34
I saw so bad cron packages on Slackware I couldnt believe they put that into the distro. We were laughing with my friend on how crond does not executes the tasks. So after that no wonder that I found many messed up crons in freebsds.

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 ]

Posted by Anonymous (173.48.xx.xx) on Tue 19 Oct 2010 at 19:46
Thanks to all for your generous help.

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 ]

Posted by Anonymous (84.14.xx.xx) on Wed 20 Oct 2010 at 10:43
It seems there's 2 problems, one with start-stop-demon (you solved it) and another one. Perhaps some permission problem on /var/spool/cron ?

[ Parent | Reply to this comment ]

 

 

Flattr