From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 07:14:47 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 86B9716A41F; Thu, 20 Oct 2005 07:14:47 +0000 (GMT) (envelope-from molter@tin.it) Received: from ams-iport-1.cisco.com (ams-iport-1.cisco.com [144.254.224.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1DBD43D5A; Thu, 20 Oct 2005 07:14:46 +0000 (GMT) (envelope-from molter@tin.it) Received: from ams-core-1.cisco.com ([144.254.224.150]) by ams-iport-1.cisco.com with ESMTP; 20 Oct 2005 09:14:45 +0200 Received: from xbh-ams-332.emea.cisco.com (xbh-ams-332.cisco.com [144.254.231.87]) by ams-core-1.cisco.com (8.12.10/8.12.6) with ESMTP id j9K7EXHJ021613; Thu, 20 Oct 2005 09:14:43 +0200 (MEST) Received: from xfe-ams-332.cisco.com ([144.254.231.73]) by xbh-ams-332.emea.cisco.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 20 Oct 2005 09:14:42 +0200 Received: from barbapapa.cisco.com ([144.254.53.64]) by xfe-ams-332.cisco.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 20 Oct 2005 00:14:41 -0700 Received: by barbapapa.cisco.com (Postfix, from userid 1000) id 2EF84107; Thu, 20 Oct 2005 09:15:03 +0200 (CEST) From: Marco Molteni To: Robert Watson Date: Thu, 20 Oct 2005 09:15:02 +0200 User-Agent: KMail/1.8.2 References: <200510191715.21582.molter@tin.it> <20051019213807.2b676e95.molter@tin.it> <20051020024753.M98055@fledge.watson.org> In-Reply-To: <20051020024753.M98055@fledge.watson.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510200915.02869.molter@tin.it> X-OriginalArrivalTime: 20 Oct 2005 07:14:41.0900 (UTC) FILETIME=[F0C79AC0:01C5D545] Cc: hackers@freebsd.org Subject: Re: rc scripts: how to start a process that doesn't daemonize itself? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2005 07:14:47 -0000 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