From owner-freebsd-stable Sun Jun 3 12:54:28 2001 Delivered-To: freebsd-stable@freebsd.org Received: from tp.databus.com (p101-46.acedsl.com [160.79.101.46]) by hub.freebsd.org (Postfix) with ESMTP id 6A95637B401 for ; Sun, 3 Jun 2001 12:54:24 -0700 (PDT) (envelope-from barney@tp.databus.com) Received: (from barney@localhost) by tp.databus.com (8.11.3/8.11.3) id f53JqH232534; Sun, 3 Jun 2001 15:52:17 -0400 (EDT) (envelope-from barney) Date: Sun, 3 Jun 2001 15:52:12 -0400 From: Barney Wolff To: Valentin Nechayev Cc: Gregory Bond , stable@FreeBSD.ORG Subject: Re: Who's HUPing my daemon? Message-ID: <20010603155212.A32453@tp.databus.com> References: <200106010210.MAA26759@lightning.itga.com.au> <20010603185509.C891@iv.nn.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010603185509.C891@iv.nn.kiev.ua>; from netch@iv.nn.kiev.ua on Sun, Jun 03, 2001 at 06:55:09PM +0300 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Wouldn't running the daemon under nohup in /usr/local/etc/rc.d/xxx.sh accomplish the same thing? I know it's inelegant, but it should work, unless I'm missing something. Barney Wolff On Sun, Jun 03, 2001 at 06:55:09PM +0300, Valentin Nechayev wrote: > Fri, Jun 01, 2001 at 12:10:35, gnb (Gregory Bond) wrote about "Who's HUPing my daemon?": > > Proper daemonization consists of many steps, some of them are: > > 1) chdir("/"), to prevent staying on file system which must be unmounted. > (But let's consider changing sysctl kern.corefile to absolute path.) > 2) Close all unneeded file handles, including 0,1,2, and reopen > /dev/null or log files on them. > 3) Setup own session with setsid(). This is exact what you need now. > > Of course, daemon() will do the same in one call of itself, but it is > unportable. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message