[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Checking init.d script for policy compliance.



On 04-Apr-03, 14:48 (CST), Bill Allombert <allomber@math.u-bordeaux.fr> wrote: 
> stop)	echo -n "Stopping periodic command scheduler: cron"
>         start-stop-daemon --stop --quiet --exec /usr/sbin/cron
>         echo "."
>         ;;
> restart) echo -n "Restarting periodic command scheduler: cron"
>         start-stop-daemon --stop --quiet --exec /usr/sbin/cron
>         start-stop-daemon --start --quiet --exec /usr/sbin/cron
>         echo "."
>  
> will make restart fail if cron is not running because this script do not
> set -e as expected. The same for the others. Sorry about the confusion.

Ah, I completely missed your point: I thought you meant that you
expected "/etc/init.d/cron restart" would not start cron daemon unless
cron were already running. No, 'set -e' is what *makes* the script fail
if it hits an error. In this particular case, we don't want it to, so
we don't 'set -e' (as you've figured out, I think, just making it clear
for those following along). Sloppily, we depend on start-stop-daemon to
print something for "real" errors.

However, you're correct, it's not completely clear. A better practice
might be to add '--oknodo' to the commands. The only practical effect
ends up being (maybe) on the init script's exit code, which is, of
course, a subject of discussion/disagreement.

Steve

-- 
Steve Greenland
    The irony is that Bill Gates claims to be making a stable operating
    system and Linus Torvalds claims to be trying to take over the
    world.       -- seen on the net



Reply to: