SunOS server 5.10 Generic_141445-09 i86pc i386 i86pc
Recently, I went to configure a script to run every 2 hours using the
following syntax:
0 0,2,4,6,8,10,12,14,16,18,20,22 * * * /path/
to/script.sh > /dev/null 2>&1
As far as I can tell, this syntax is correct. The problem is, it
doesn't work, the script only runs every day at midnight, which is
frustrating.
Can anyone shed light on this? Is this a known problem, did I
misconfigure something?
Thanks.
Not enough info, so just guessing here...
Did you use "crontab -e" to set it up or just edited the cron file?
What does the cron log say? Check /var/cron/log
Sorry about that.
The logs say it's running, but it doesn't run. The command itself
leaves a log of its activities in /tmp.
The last entry in /var/cron/log says:
CMD: /path/to/command.sh > /dev/null 2>&1
> root 28052 c Wed Dec 1 14:00:00 2010
< root 28052 c Wed Dec 1 14:42:52 2010 rc=24
rc=24 is that a return code.
Thanks.
>>> 0 0,2,4,6,8,10,12,14,16,18,20,22 * * * /path/
>>> to/script.sh> /dev/null 2>&1
> The logs say it's running, but it doesn't run. The command itself
> leaves a log of its activities in /tmp.
>
> The last entry in /var/cron/log says:
>
> CMD: /path/to/command.sh> /dev/null 2>&1
>> root 28052 c Wed Dec 1 14:00:00 2010
> < root 28052 c Wed Dec 1 14:42:52 2010 rc=24
>
> rc=24 is that a return code.
So the script seems to run for 42 minutes and crash perhaps before
writing any of its own log. rc=24 is probably the return code of
whatever failed.
> As far as I can tell, this syntax is correct.
I don't see anything wrong with it either, assuming the two lines you
posted are in fact a single line in the original crontab entry and that
the separators are just \040s and \009s.
Some things to try:
1) Temporarily replace /path/to/script.sh with a "date >$HOME/lastran"
script to see whether crontab is calling it or not;
2) Remove the >/dev/null and 2>&1 and check the output;
3) Run /path/to/script.sh by hand, being careful to emulate the limited
initialization environment that crontab provides and see what happens.
As a separate issue, running cron jobs at 02:00 local time may not work as
intended on the Sundays when Daylight Time starts or ends.
-WBE
According to:
http://www.unix.com/solaris/38391-var-cron-log-return-codes.html
Error code 24 appears to be "Too many open files"
I presume you script runs fine by hand?
Of course, I didn't read all the way to the boot so those numbers
likely don't apply.
At any rate, I suspect it is a problem with the script. Have you
tried something simpler that should work like touching a file and
giving it time coded name?
Remove the "> /dev/null 2>&1" and see what shows up in the log and error
mail.
--
Jim Pennino
Remove .spam.sux to reply.
Thanks for the info. I'm trying to track this down. Tho the script
only calls an rsync command.
The funny thing is that tho it's configured to run every 2 hours; it
only really works successfully at midnight.
yes, when I run it by hand it doesn't error at all....
>>> rc=24 is that a return code.
>>
>> So the script seems to run for 42 minutes and crash perhaps before
>> writing any of its own log. rc=24 is probably the return code of
>> whatever failed.
>
> Thanks for the info. I'm trying to track this down. Tho the script
> only calls an rsync command.
perhaps this might help
http://samba.anu.edu.au/rsync/FAQ.html#10