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

Re: systemd now appears to be only possible init system in testing



Cameron Norman <camerontnorman@gmail.com> writes:

> Oh this is easy. The init script calls s-s-d and does not check the return
> code (so always exits 0). I am just going to use set -e in the init
> script, only a couple tweaks are needed.

Please don't use set -e in init scripts.  See Policy 9.3.2:

    Be careful of using set -e in init.d scripts.  Writing correct init.d
    scripts requires accepting various error exit statuses when daemons
    are already running or already stopped without aborting the init.d
    script, and common init.d function libraries are not safe to call with
    set -e in effect.  For init.d scripts, it's often easier to not use
    set -e and instead check the result of each command separately.

Not mentioned there is another problem, namely that LSB mandates
particular exit codes for particular conditions in init scripts, and set
-e will not produce the correct exit codes.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: