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

Re: Disable a service



On Sb, 09 apr 11, 11:04:52, Dan 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

This might work for a single runlevel, but has unexpected results if you 
remove all symlinks:

,----[ man update-rc.d ]
| A common system administration error is to delete the links with the 
| thought that this will "disable" the service, i.e., that this will pre‐
| vent the service from being started.  However, if all links have been 
| deleted then the next time  the  package  is  upgraded,  the  package's
| postinst script will run update-rc.d again and this will reinstall links 
| at their factory default locations.  The correct way to disable ser‐
| vices is to configure the service as stopped in all runlevels in which 
| it is started by default.  In the System	V  init  system  this  means
| renaming the service's symbolic links from S to K.
`----

> 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?

Besides what is written in 'man update-rc.d' it is also necessary to run 
insserv, which is not very well documented:

# mv /etc/rc3.d/S20bluetooth /etc/rc3.d/K00bluetooth
# insserv

(the actual number after the K doesn't really matter due to insserv)

Reactivating:
# mv /etc/rc3.d/K00bluetooth /etc/rc3.d/S20bluetooth
# insserv

(the number after the K might be different if insserv changed it and the 
number after the S doesn't matter since insserv will re-order as needed.

Regards,
Andrei
-- 
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic

Attachment: signature.asc
Description: Digital signature


Reply to: