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

Re: Disable a service



On 9 April 2011 16:04, Dan <ganchya@gmail.com> wrote:
> Hi,
> I would like to know which is the standard way to disable services. I
> thought that the standard way is just to delete the link of the
> service from rc*.d
>
> For example to disable bluetooth I would just delete the link
> /etc/rc3.d/S20bluetooth that points to ../init.d/bluetooth
>
> But then I used service manager from gnome to disable bluetooth. It
> disabled the service but it didn't delete the link. So I guess that
> there is a standard procedure to disable the service without deleting
> the link. Which is that procedure?
>
> Thanks,
> Dan
Debian Linux has its own script to enable and disable services across
runlevels. It is called update-rc.d. Going by the above example, you
can enable apache webserver as follows:

# update-rc.d apache2 defaults

... this will enable the apache webserver to start in the default run
levels of 2,3,4 and 5. Of course, you can do it explicitly by giving
the run levels instead of the "defaults" keyword as follows:

# update-rc.d apache2 start 20 2 3 4 5 . stop 80 0 1 6 .

The above command modifies the sym-links in the respective /etc/rcX.d
directories to start or stop the service in the destined runlevels.
Here X stands for a value of 0 to 6 depending on the runlevel. One
thing to note here is the dot (.) which is used to terminate the set
which is important. Also 20 and 80 are the sequence codes which
decides in what order of precedence the scripts in the /etc/init.d/
directory should be started or stopped.

And to disable the service in all the run levels, you execute the command:

# update-rc.d -f apache2 remove

Here -f option which stands for force is mandatory.

But if you want to enable the service only in runlevel 5, you do this instead:

# update-rc.d apache2  start 20 5 . stop 80 0 1 2 3 4 6 .

-- 
Michael
http://photography.thompsonm.me.uk

To see a World in a Grain of Sand
And a Heaven in a Wild Flower,
Hold Infinity in the palm of your hand
And Eternity in an hour.
--William Blake


Reply to: