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

Re: Init.d script, preventing start of one service



Hello,

On Tue, Nov 11, 2003 at 06:04:31PM +0100, Andreas Metzler wrote:
> I am redirecting to debian-mentors, imho the more appropriate list.
> 

Thanks, i will continue go and look for it.

> On Tue, Nov 11, 2003 at 04:27:03PM +0100, Sylvain LE GALL wrote:
> > In one of the package i maitain i have a config script which begin by
> > asking if the service attached to this package need to be run. I use a
> > variable ( stored in /etc/default/mldonkey -- LAUNCH_AT_STARTUP="yes" )
> > to determine if i need to run the service or not.
> 
> > If the variable is set to yes, the init script launch the service,
> > otherwise it does nothing. 
> 
> I think that is the best solution currently possible.
> 
> > The user ask me if i can use update-rc.d to create/remove symlink
> > depending on the former LAUNCH_AT_STARTUP value.
> 
> IMHO it is dubious whether you are allowed to do that, it would work
> *basically*[1] like this in postinst:
> ------------------
> db_get mldonkey/runservice
> runme="$RET"
> if [ "$RET" = "true" ]
>   update-rc.d -f remove mldonkey
>   update-rc.d mldonkey defaults
> else
>   update-rc.d -f remove mldonkey
>   update-rc.d mldonkey stop 20
> fi
> ...
> invoke-rc.d mldonkey start
> ------------------
> And invoke-rc.d will only start the service if it has a start-entry in
> the sysvinit system for the current runlevel.
> 
> The big problem is that you loose user configuration, i.e. if $user
> has set up his system to run mldonkey only in runlevel5 you will nuke
> it.
> 

I totally agree on that... I think update-rc.d is admin stuff. ( i just
want to use it for registering / unregistering init script ).

> And there is no way around it, as it is impossible to query what links
> currently exist. (You cannot do ls in the symlink-directories, see
> file-rc), you may only interface with the init-stuff with invoke- and
> update-rc.d.
> 
> > What is the standard solution for doing this in debian?
> 
> Afaict the standard solutions are:
> - ship daemon and clients in separate packages (ftp, ssh, nfs, ...) to
>   circumvent the problem (no option for mldonkey afaict)
> - Choose a default and let the user change it by hand instead of via
>   dpkg-reconfigure. 
> 

That is what is actually done ( mldonkey-server / mldonkey-client and
LAUNCH_AT_STARTUP configure via dpkg-reconfigure ).

Thanks for your repsonse
Kind regard
Sylvain LE GALL



Reply to: