[ELDK] crond not working

Wolfgang Denk wd at denx.de
Fri Feb 26 10:59:00 CET 2010


Dear Germano Barreiro,

In message <681741761002251428x51c780f2oa9d5d10cc1766a46 at mail.gmail.com> you wrote:
> I checked if the daemon was running through a ps ax | grep cron
> command. Also tried to execute it by hand with the option -n plus some
> -x options.
> On the other side, the script it was trying to execute has execution
> permissions and, of course, I can execute it manually.

Keep in mind that crond runs with limited PATH settings (normally
only containing "/bin" and "/usr/bin") - eventually your commands
cannot be found?

> Assuming that the crond can do its job, it is really weird what is happening.

I just tested this again, and it's working fine for me. Example:

Set up crontab entry:

	-bash-3.2# crontab -l
	#---------------------------------------------------------------
	# m  h  D  M  w  cmd
	#---------------------------------------------------------------
	*/3  *  *  *  *   /tmp/script.sh

Prepare test script:

	-bash-3.2# ls -l /tmp/script.sh 
	-rwxr-xr-x 1 root root 70 Feb 26 10:39 /tmp/script.sh
	-bash-3.2# cat /tmp/script.sh 
	#!/bin/sh
	echo ===== Running ===== >>/tmp/logfile
	date >>/tmp/logfile

Make sure we don't have stale data:

	-bash-3.2# rm -f /tmp/logfile

Start crond:

	-bash-3.2# date
	Fri Feb 26 10:50:06 CET 2010
	-bash-3.2# service crond start
	Starting crond: [  OK  ]

Verify we still don;t have any output:

	-bash-3.2# date
	Fri Feb 26 10:50:35 CET 2010
	-bash-3.2# cat /tmp/logfile
	cat: /tmp/logfile: No such file or directory

Wait a while, then look again:

	-bash-3.2# date
	Fri Feb 26 10:54:07 CET 2010
	-bash-3.2# cat /tmp/logfile
	===== Running =====
	Fri Feb 26 10:51:01 CET 2010
	===== Running =====
	Fri Feb 26 10:54:02 CET 2010

I recommend you to check your script again...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Program maintenance is an entropy-increasing process,  and  even  its
most skilfull execution only delays the subsidence of the system into
unfixable obsolescence.       - Fred Brooks, "The Mythical Man Month"


More information about the eldk mailing list