Tearing down the system

Scott James Remnant scott at ubuntu.com
Fri Jul 21 00:24:40 BST 2006

For edgy we're going to be attacking the init scripts that perform
something on shutdown (rc0.d) or reboot (rc6.d) that is completely

The specification for that is:


Broadly speaking, if you have a package in Ubuntu with an init script,
you should question whether it really needs to run in these two run

If your script does nothing more for the "stop" argument than:

 * Send a TERM signal to the process.

 * Wait using sleep (and not any further checking, such as against a
   queue or similar)

 * Send a KILL signal to the process.

Then it should NOT have a symlink in rc0 or rc6.

Currently most scripts only do the first thing, and some don't even do
that and just exit if "stop" is given as the argument.  This is a waste
of time, as this is performed by the sendsigs script anyway.

Also if your script does something that's reasonably pointless given the
machine is about to go away, such as clean up files in /var/run (a
tmpfs), /var/lock (also a tmpfs), etc. it should not have a symlink in
these run levels either.

Changing your package is easy, you're probably calling the following in
your debian/rules:

	dh_installinit defaults

Change that to

	dh_installinit multiuser

Maybe you're calling update-rc.d in your postinst instead, change:

	update-rc.d foo defaults


	update-rc.d foo multiuser

If you're using more complicated arguments, make sure you drop "0" and
"6" from the list of runlevels for "stop", e.g.:

	update-rc.d foo start 35 2 3 4 5 . stop 65 0 1 6 .


	update-rc.d foo start 35 2 3 4 5 . stop 65 1 .

Be sure to remove up the old symlinks from /etc/rc0.d and /etc/rc6.d in
your postinst if your package is upgraded.

Scott James Remnant
scott at ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/ubuntu-devel-announce/attachments/20060721/1cb9b37a/attachment.pgp

More information about the ubuntu-devel-announce mailing list