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

update-rc.d



Hi,

I'd like to raise a couple of suggestions for update-rc.d.

First, there are some problems that currently affect startup scripts:

	* It's not obvious how to go about disabling /etc/init.d
	  scripts from running correctly.

	  (update-rc.d remove doesn't stay removed when a package gets
	  upgraded, editing the init.d script always feels like a hack
	  and encourages dpkg to whine at you later, and rm'ing all the
	  S* links, but not all of the K* links is a little obscure,
	  and doesn't work properly either)

	* The only way to ensure a service *never* gets started
	  automatically (adding an "exit 0" in the init.d script) also
	  makes it impossible to start it manually.

	* When running /etc/init.d/foo restart in postinsts, you
	  can accidently start a service in a runlevel where it's not
	  meant to be started. 

	  (if you're running in single-user mode, or have a more
	  complicated setup than the default runlevels)

	* When running /etc/init.d/foo start in postinsts, you can
	  inherit bad environment settings.

	* When running /etc/init.d/foo start from a root prompt, you
	  can inherit bad environment settings.

What I'd like to suggest is something along the lines of:

	update-rc.d foo disable
		-- to disable foo in such a way that later postinsts don't
		   re-enable it.

	update-rc.d foo enable
		-- to restore the original settings

and

	update-rc.d foo -s start
		-- to run "/etc/init.d/foo start" if foo is meant to be
		   running in this runlevel.

Expected usage in postinsts would be:

	update-rc.d foo defaults -s restart

If update-rc.d -s start were to go to some special effort to ensure
environment settings made sense, that would leave only the last flaw
listed above.

(Implementing "disable" and "enable" for sysvinit are pretty easy -- disable
can just change all the symlinks to point to /bin/true, and enable change
them back to /etc/init.d/foo. It could also just remove all the S links,
but this makes re-enabling it later harder for the sysadmin.)

Since update-rc.d is a standard interface, and is provided by a couple
of packages, it seemed more appropriate to discuss this here than to
harass the respective maintainers.

Cheers,
aj

--
Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. PGP encrypted mail preferred.

``Like the ski resort of girls looking for husbands and husbands looking
  for girls, the situation is not as symmetrical as it might seem.''

Attachment: pgpVhPdMjjyzX.pgp
Description: PGP signature


Reply to: