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

Upgrading packages with init scripts

  Hi everybody, 

  I have a proposal related to the way init scripts are handled on upgrades;
  when you upgrade a package that has an script in /etc/init.d/ the typical
  procedure is stop the service on the 'preinst' and start it again on the
  'postinst' or restart it on the 'postinst'.  

  The problem I see with this is that if the service wasn't running because
  the admin disabled it on the current runlevel (removing the start symlink in
  the '/etc/rcRUNLEVEL.d/' or the current RUNLEVEL in '/etc/runlevel.conf' if
  using 'file-rc') the program is started automatically on the postinstall,
  leaving a service running when it should be stopped.

  My proposal is to have some standard way to control if a service must be
  (re)started on upgrades, depending on the current runlevel, in the same
  spirit of update-rc.d, maybe something like:

    control-init.d SCRIPT ACTION

  where SCRIPT is the name of the '/etc/init.d' script and ACTION is one of
  My first aproach is that 'control-init.d' presumes that the desired state of
  a service is the one configured with 'file-rc' or the rc.d symlinks:
    - It only applies the 'start', 'restart' or 'force-reload' commands if the
      service is supposed to be active in the current runlevel.
    - The 'stop' and 'reload' commands probably should be executed always (if
      the service is not running they will not do any harm and if it was
      started manually and an upgrade needs to stop it, I think it's OK to
      leave it stopped).

  Any comments, ideas, opinions?  Should I post a 'beta' version of

  Kind regards,


Attachment: pgp9NUXZM5caz.pgp
Description: PGP signature

Reply to: