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

Re: The right way to not start daemons

On Mon, 5 Nov 2001, Jacob Kuntz wrote:

> On Tue, Nov 06, 2001 at 08:20:27AM +1100, Craig Small wrote:
> [snip]
> > 
> > I suppose there is a way of using debconf here too, perhaps there are
> > other ways.
> I've always done update-rc.d -f $package remove. This works for any
> pacakges, but the only way to make it start again would be to use
> update-rc.d $package defaults, which may not be appropriate for that
> package.

There is a simple solution, that does not need any changes to existing
packages -- except dpkg -- avoids modified conffiles and has the advantage 
that a warning message is issued each time someone is trying to start (or
stop) a disabled daemon.

All we need is to create a init.d script called disabled or somesuch with
the following contents:

#! /bin/sh
echo "\``basename $0`' has been disabled in \`/etc/init.d'."
exit 0

Then "update-rc.d <basename> disable" would rename the original init.d
script to <basename>.disabled and create a symlink from
/etc/init.d/disabled to /etc/init.d/basename.

When installing new init.d scripts dpkg would replace <basename>.disabled
instead of <basename> if <basename> is a symlink to /etc/init.d/disabled.

Reenabling a service is obviously done by simply renaming
/etc/init.d/<basename>.disabled back to /etc/init.d/<basename> which
would be done by "update-rc.d <basename> enable".

Reply to: