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

Re: problem with debconf and start-stop-daemon



On Fri, 11 Jan 2002, Wichert Akkerman wrote:
> Previously Henrique de Moraes Holschuh wrote:
> > Please tell me one good reason not to use the init.d script interface to
> > muck around with daemons _in maintainer scripts_?
> 
> The --exec option for start-stop-daemon. This option is very useful: it
[...]
> The only problem with the --exec option is that it does not work if
> you use it in the postinst after an upgrade to restart the daemon
> since the binary has been replaced and will now have a different inode.

Yes. When one both replace the daemon executable AND the initscript uses
start-stop-daemon --exec, one has to stop the daemon in prerm. Lots of
packages do this already. I believe it is the default behaviour for
dh_initscript for example.

Any package that is -replacing- the daemon executable should know very well
what its initscript does, and how. In fact, in just about 99% of the cases,
either the same binary package or source package will provide the initscript
and the executable.  So I will assume we are talking about a maintainer
script maintained by the same person/crew that maintains the initscript.

The prerm solution is a problem for those who need to shorten the downtime
of the service.  e.g, IDS daemons. For those, it is still possible to have a
new target (say, stop-nocheck) in the init.d script that does not use
--exec, exactly the way it would be done in the postinst.

> 1. don't use --exec at all, not even in the init script.
> 2. don't use --exec in the postinst, or use it with a saved (hardlinked)
>    copy of the original file

Actually, I was not aware of 2). I like it.  While it would be possible (but
ugly) to have such an "stop-alike /usr/sbin/daemon.temp" initscript target,
it would look a bit kludgy (but perfectly legal, and supported).

Well, policy will say "should", not "must" for the use of invoke-rc.d and
initscripts. There is no reason why we could not add a sentence to the
effect of "maintainer scripts that cannot use the initscript for some reason
to execute an action on the service, must verify (using invoke-rc.d
--query), if they would be allowed to execute a given initscript action
(stop, start, restart, reload) before doing so directly."

i.e., you could either live with a new action in your init.d script (using
either method 1 or 2 to stop the daemon), stop it in prerm, or call
invoke-rc.d to verify if the admin frowns upon what you're going to do and
if it says its ok, do the start-stop-daemon thing directly.

Would that be good enough?

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



Reply to: