rc scripts: how to start a process that doesn't daemonize
itself?
Robert Watson
rwatson at FreeBSD.org
Wed Oct 19 18:49:25 PDT 2005
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 N M Watson
More information about the freebsd-hackers
mailing list