From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 10 23:19:23 2003 Return-Path: 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 9C9DD16A4CE for ; Mon, 10 Nov 2003 23:19:23 -0800 (PST) Received: from mail2.dslextreme.com (mail2.dslextreme.com [66.51.199.52]) by mx1.FreeBSD.org (Postfix) with SMTP id E2A8A43FDD for ; Mon, 10 Nov 2003 23:19:22 -0800 (PST) (envelope-from jos@catnook.com) Received: (qmail 28478 invoked from network); 11 Nov 2003 07:19:21 -0000 Received: from unknown (HELO w250.z064001178.sjc-ca.dsl.cnc.net) (66.218.45.239) by 192.168.8.48 with SMTP; Tue, 11 Nov 2003 07:19:21 +0000 Received: (qmail 83983 invoked by uid 1000); 11 Nov 2003 07:19:44 -0000 Date: Mon, 10 Nov 2003 23:19:22 -0800 From: Jos Backus To: freebsd-hackers@freebsd.org Message-ID: <20031111071944.GA5778@lizzy.catnook.com> Mail-Followup-To: freebsd-hackers@freebsd.org References: <3F9CF3F6.8307.ABC1250@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F9CF3F6.8307.ABC1250@localhost> User-Agent: Mutt/1.5.5.1i Subject: Re: non-root process and PID files X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: jos@catnook.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2003 07:19:23 -0000 On Mon, Oct 27, 2003 at 10:31:18AM -0500, Dan Langille wrote: > If a process starts up and does a setuid, should it be writing the > PID file before or after the setuid? > > Two methods exists AFAIK: > > 1 - write your PID immediately, and the file is chown root:wheel > 2 - write your PID to /var/run/myapp/myapp.pid where /var/run/myapp/ > is chown myapp:myapp > > Of the two, I think #1 is cleaner as it does not require another > directory with special permissions. > > Any suggestions? Why use pid files at all if you could be using a process supervisor instead? -- Jos Backus _/ _/_/_/ Sunnyvale, CA _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/ jos at catnook.com _/_/ _/_/_/ require 'std/disclaimer'