From owner-freebsd-questions Mon Nov 25 17:11: 1 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB16237B401 for ; Mon, 25 Nov 2002 17:10:59 -0800 (PST) Received: from mail3.sea.registeredsite.com (mail3.sea.registeredsite.com [66.111.73.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id B5E4043E88 for ; Mon, 25 Nov 2002 17:10:58 -0800 (PST) (envelope-from admin@asarian-host.net) Received: from asarian-host.net (asarian-host.net [216.122.74.112]) by mail3.sea.registeredsite.com (8.12.5/8.12.5) with ESMTP id gAQ1AoSF019488 for ; Mon, 25 Nov 2002 20:10:52 -0500 Comments: To protect the identity of the sender, certain header fields are either not shown, or masked. Anonymous email addresses for asarians can be requested by filling in the appropriate form at: https://asarian-host.net/cgi-bin/signup.cgi Received: (from root@localhost) by asarian-host.net (8.11.0/8.11.0) id gAQ1AjP81232 for freebsd-questions@freebsd.org; Tue, 26 Nov 2002 02:10:45 +0100 (CET) (envelope-from admin@asarian-host.net) Posted-Date: Tue, 26 Nov 2002 02:10:45 +0100 (CET) From: Mark Message-Id: <200211260110.GAQ1AAI81189@asarian-host.net> Date: Tue, 26 Nov 2002 02:10:30 +0100 X-Authenticated-Sender: admin@asarian-host.net Subject: Re: Apache not killing subprocesses, only on FreeBSD X-Trace: KwNgMzDA8MUKb5iRNoVV1yIAY8ER5RknLPzyI4A4mafZ0usNs07l003KaFVG1Uuq X-Complaints-To: abuse@asarian-host.net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we are unable to process your complaint Organization: Asarian-host To: "Chris Dillon" , "Lee Nelson" Cc: References: <20021125112037.W39486-100000@duey.wolves.k12.mo.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Auth: Asarian-host PGP signature iQEVAwUAPeLKFTFqW1BleBN9AQHDiQgAkuS2vX/kqQNcBw/fm1oWnBjICvV4CKy5 KAGqxBEo7rbxUvKhN26wRxdi2UwWCEqu3ZixCpgReJd68xekMUoxBO1mbluln3C/ snoTAeTgDLFU41xOuf17WDbIIb85KVO3QeqVfDCbwESJh1cryIFyQ0Ms4hUXEAUt qRFSdsUvnXy43A0HcnIAqqOSwg04D1cIPpSvhvsVLQlRSXDaAQvYDcsM79Mb0pTl TXvsKDlFTo41nYHrUeul5AB9Jf63CyDKFvPg/3E3JMNohtTMP52RYVAZvOwsxrJB IgJSva2sg2f5fUc2cK3RimAtkiMgVmL/H/I5tCDxrsPWCJ93spllLA== =uF3H Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ----- Original Message ----- From: "Chris Dillon" To: "Lee Nelson" Cc: Sent: Monday, November 25, 2002 6:23 PM Subject: Re: Apache not killing subprocesses, only on FreeBSD > On Sun, 24 Nov 2002, Lee Nelson wrote: > > > myprogram.pl reads a few parameters from STDIN, and then > > forks to work in the background: I daemonize as follows: chdir ('/') || exit 1; open STDIN, '/dev/null'; open STDOUT, '>/dev/null'; if (my $pid = fork ()) { open (PID, '>/var/run/my-prog.pid') || exit 1; flock (PID, 2); print PID "$pid"; close (PID); exit 0; } POSIX::setsid () || exit 1; # follow the leader open STDERR, '>&STDOUT'; Guaranteed to become the session leader, and completely dissociates from the terminal. - Mark To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message