Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Crontab issues with Solaris 10

1,241 views
Skip to first unread message

for...@gmail.com

unread,
Dec 1, 2010, 2:06:01 PM12/1/10
to
I'm running Solaris 10 on a Sun thumper (X4530). The OS version is:

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.

Oscar del Rio

unread,
Dec 1, 2010, 2:42:00 PM12/1/10
to
On 12/ 1/10 02:06 PM, for...@gmail.com wrote:
> I'm running Solaris 10 on a Sun thumper (X4530). The OS version is:
>
> 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.

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

for...@gmail.com

unread,
Dec 1, 2010, 3:32:58 PM12/1/10
to

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.

Oscar del Rio

unread,
Dec 1, 2010, 3:54:41 PM12/1/10
to
On 12/ 1/10 03:32 PM, for...@gmail.com wrote:
> On Dec 1, 2:42 pm, Oscar del Rio<del...@mie.utoronto.ca> wrote:
>> On 12/ 1/10 02:06 PM, for...@gmail.com wrote:

>>> 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.

Winston

unread,
Dec 1, 2010, 5:59:41 PM12/1/10
to
"for...@gmail.com" <for...@gmail.com> writes:
> 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.

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

chuckers

unread,
Dec 1, 2010, 6:22:14 PM12/1/10
to

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?

chuckers

unread,
Dec 1, 2010, 6:53:52 PM12/1/10
to

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?

ji...@specsol.spam.sux.com

unread,
Dec 1, 2010, 7:00:45 PM12/1/10
to

Remove the "> /dev/null 2>&1" and see what shows up in the log and error
mail.

--
Jim Pennino

Remove .spam.sux to reply.

for...@gmail.com

unread,
Dec 3, 2010, 4:11:52 PM12/3/10
to

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.

for...@gmail.com

unread,
Dec 3, 2010, 4:12:35 PM12/3/10
to

yes, when I run it by hand it doesn't error at all....

Oscar del Rio

unread,
Dec 3, 2010, 4:40:33 PM12/3/10
to
On 12/ 3/10 04:11 PM, for...@gmail.com wrote:
> On Dec 1, 3:54 pm, Oscar del Rio<del...@mie.utoronto.ca> wrote:

>>> 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

0 new messages