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

Bug#76868: invoke-rc.d proposal)

(sorry for the Delay, workload has skyrocked for a few days -HMH)

On Mon, 13 Nov 2000, Anthony Towns wrote:
> I still don't like restart-if-running though. I don't think "if"s should be
> in the arguments, and I'd be much more inclined towards something like:
> 	if [ `/etc/init.d/foo status` = "running" ]; then
> 		/etc/init.d/foo restart
> 	fi

This will be probably possible with LSB-compatible initscripts. I didn't
propose 'status' because it is actually much harder to write than
'restart-if-running' (see LSB specs) -- which would result in a lot of
complains, AND it would be a bad move to implement status in an incompatible
with the LSB way (and the LSB isn't frozen yet).

As for the 'if' in 'restart-if-running', it was not my idea. So far I have
two votes for 'restart-if-running' and only one complain (yours) against the
'-if' in there, so you're (currently) outvoted.

> I'm also (duh) against falling back to a new, optional argument without
> any indication that's appropriate when called. I think that's a really bad
> design. But I'm not really sure what more I can say to convince you this
> is a bad idea. :-/

I thought you hated the idea of error messages (by the end of that past
thread on the issue, at least)? well, here's what the current invoke-rc.d
would output:

(in a fallback request)
godzillah:/tmp/sysvinit$ ash ./invoke-rc.d nfs-kernel-server restart
invoke-rc.d: "restart" of nfs-kernel-server attempted out of runlevel.
invoke-rc.d: using fallback "restart-if-running" instead of "restart".
Usage: nfs-kernel-server {start|stop|reload|force-reload|restart}
invoke-rc.d: initscript nfs-kernel-server, action "restart-if-running" failed.

(in a straight restart-if-running request to a initscript not implementing it)
godzillah:/tmp/sysvinit$ ash ./invoke-rc.d inetd restart-if-running
Usage: /etc/init.d/inetd {start|stop|reload|restart}
invoke-rc.d: initscript nfs-kernel-server, action "restart-if-running" failed.

Here's what 'restart-if-running' might look like for a sane daemon:

        echo -n "Stopping $DESC if it is running: "
        if start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid --exec ${DAEMON} ; then
                echo "${NAME}."
                echo -n "Restarting $DESC: "
                start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec ${DAEMON}
                echo "${NAME}."
                echo "(not running)."

You can convince me that the 'restart-if-running' fallback is a bad idea if
you give me a concrete example where things will break because of the
restart-if-running fallback, OR if you give me another solution that is
workable. Also, do remember that the fallback will only happen in a system
where the local administrator knows enough about runlevels to change
Debian's default of 'start service in all runlevels'.

The only other workable solution I can see is to make 'restart-if-running'
(or the LSB status thingie) mandatory for all Debian packages that start
daemons, make it mandatory to use 'restart-if-running' instead of 'restart'
in maintainer packages, and make it mandatory to expect the call to fail and
a script to act reasonably (no aborting the execution of maintainer
scripts!) when requesting it from any package not known to implement it

> Any chance you could be convinced to split this into two separate
> proposals?

Yes, invoke-rc.d is much more important than 'restart-if-running'.  Please
read the above, and tell me if you two still want the proposal split.

  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

Attachment: pgp1GsOD3wDqD.pgp
Description: PGP signature

Reply to: