Re: rc scripts: how to start a process that doesn't daemonize itself?
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 ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: rc scripts: how to start a process that doesn't daemonize itself?
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 ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: rc scripts: how to start a process that doesn't daemonize itself?
On Wed, 19 Oct 2005 10:36:55 -0500 Dan Nelson <[EMAIL PROTECTED]> wrote: > In the last episode (Oct 19), Marco Molteni said: > > I have a program that I would like to control via a rc script, > > say /usr/local/etc/rc.d/myprog > > > > problem is this program needs to be put explicitly in background. > > > > I was playing with things like > > > > command="/usr/sbin/daemon /usr/local/bin/myprog" > > > > but this obviously works only for the start case. > > > > Should I just override start() completely or is there a > > common way to do it? I don't think I can simply pass a "&" > > somewhere... > > 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 ;-) thanks again marco -- He who receives an idea from me, receives instruction himself without lessening mine; as he who lights his taper at mine, receives light without darkening me. -- Thomas Jefferson ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: rc scripts: how to start a process that doesn't daemonize itself?
In the last episode (Oct 19), Marco Molteni said: > I have a program that I would like to control via a rc script, > say /usr/local/etc/rc.d/myprog > > problem is this program needs to be put explicitly in background. > > I was playing with things like > > command="/usr/sbin/daemon /usr/local/bin/myprog" > > but this obviously works only for the start case. > > Should I just override start() completely or is there a > common way to do it? I don't think I can simply pass a "&" somewhere... 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" -- Dan Nelson [EMAIL PROTECTED] ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: rc scripts: how to start a process that doesn't daemonize itself?
Marco Molteni wrote: Should I just override start() completely or is there a common way to do it? I don't think I can simply pass a "&" somewhere... Oh, yes, you can: command_args="&" should do the work. -- Alex Dupre ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
rc scripts: how to start a process that doesn't daemonize itself?
Hi, I have a program that I would like to control via a rc script, say /usr/local/etc/rc.d/myprog problem is this program needs to be put explicitly in background. I was playing with things like command="/usr/sbin/daemon /usr/local/bin/myprog" but this obviously works only for the start case. Should I just override start() completely or is there a common way to do it? I don't think I can simply pass a "&" somewhere... thanks marco ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"