Thanks for your reply.  It really clears things up.

> In shell scripts, 0 is true, 1 (or any other non-zero) is false,
> allowing for error codes.
>
How counter intuitive!!  I have had beginning C programming, (so
I'm an expert now :-) and false is zero and true is anything not
false. It's a crazy world we live in.

So:

[root@elmo cron.hourly]# chkconfig innd on
[root@elmo cron.hourly]# ! /sbin/chkconfig innd || echo "Running
nntpsend"; echo $?
Running nntpsend
0
[root@elmo cron.hourly]# chkconfig innd off
[root@elmo cron.hourly]# ! /sbin/chkconfig innd || echo "Running
nntpsend"; echo $?
0

works correctly.

And if I change the two scripts in /etc/cron.hourly:

[root@elmo cron.hourly]# cat /etc/cron.hourly/inn-cron-nntpsend
#!/bin/sh
! /sbin/chkconfig innd || su - news -c /usr/bin/nntpsend
[root@elmo cron.hourly]# cat /etc/cron.hourly/inn-cron-rnews
#!/bin/sh

! /sbin/chkconfig innd || /usr/bin/rnews -U

then I should get a return code of zero no matter whether innd
is turned on or off and thus no email from cron.

Who should make this change?

Bill Shirley


Reply via email to