Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Oct 2005 09:15:02 +0200
From:      Marco Molteni <molter@tin.it>
To:        Robert Watson <rwatson@freebsd.org>
Cc:        hackers@freebsd.org
Subject:   Re: rc scripts: how to start a process that doesn't daemonize itself?
Message-ID:  <200510200915.02869.molter@tin.it>
In-Reply-To: <20051020024753.M98055@fledge.watson.org>
References:  <200510191715.21582.molter@tin.it> <20051019213807.2b676e95.molter@tin.it> <20051020024753.M98055@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 20 October 2005 03:49, Robert Watson wrote:
> On Wed, 19 Oct 2005, Marco Molteni wrote:
> >> Try putting the "&" in command_args; that way it'll only be used
> >> during startup.  I do that in some of my homegrown rc.d scripts. 
> >> A (probably cleaner) way is to set
> >>
> >> start_cmd="/usr/sbin/daemon /usr/local/bin/myprog"
> >
> > thanks to you and the others posters for the & trick.
> >
> > It works, but as you say it smells hackish. For one, it doesn't
> > detach from the controlling tty. Not a big deal when run from init
> > I think, but it may make a difference when run multiuser from a
> > terminal (say myprog forcestart).
> >
> > anyway, better than nothing ;-)
>
> The daemon(8) page claims it detaches from the tty.  You may also
> want to use the -f argument to redirect stdio.  If it isn't working
> properly, please file a PR, thanks!

Robert,

we are actually saying the same thing ;-). I was comparing the
& (backgroud) approach done with command_args="&" to the
daemon approach done with 
start_cmd="/usr/sbin/daemon /usr/local/bin/myprog"

Maybe it wasn't clear from the quoted context.

marco



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510200915.02869.molter>