From owner-freebsd-rc@FreeBSD.ORG Tue Jul 27 15:10:11 2004 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D329316A4CE; Tue, 27 Jul 2004 15:10:11 +0000 (GMT) Received: from smtp1.utdallas.edu (smtp1.utdallas.edu [129.110.10.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id B69AE43D31; Tue, 27 Jul 2004 15:10:11 +0000 (GMT) (envelope-from pauls@utdallas.edu) Received: from utd49554 (utd49554.utdallas.edu [129.110.3.85]) by smtp1.utdallas.edu (Postfix) with ESMTP id 5E3A2388C6F; Tue, 27 Jul 2004 10:10:08 -0500 (CDT) Date: Tue, 27 Jul 2004 10:10:06 -0500 From: Paul Schmehl To: Peter Pentchev , Mike Makonnen Message-ID: <80748DD218944B5C768B62FC@utd49554.utdallas.edu> In-Reply-To: <20040727123712.GA1196@straylight.m.ringlet.net> References: <20040727123712.GA1196@straylight.m.ringlet.net> X-Mailer: Mulberry/3.1.6 (Linux/x86) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline cc: freebsd-rc@FreeBSD.org Subject: Re: rc.subr exits prematurely X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to /etc/rc.d design and implementation. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2004 15:10:11 -0000 --On Tuesday, July 27, 2004 03:37:12 PM +0300 Peter Pentchev wrote: > Hi, > > With the recent changes to rc.subr so that it executes port startup > scripts in the same shell instead of in a subshell, another problem has > come up. For the scripts which record a PID file, a check is made on > startup and on shutdown for the PID file's existence, and if it fails, > rc.subr exits, which prevents the rest of the scripts from being > executed. Attached is a quick patch which works around this problem, but > may introduce others - I'm not quite sure I understand all of rc.subr's > internal workings :) > Rather than using returns to get around the problem, wouldn't it make more sense to check for a PID using ps? It's entirely possible to have a process that's running with no pidfile. Something like this would work (I've used it before): if [ -z "$rc_pid" ]; then blah else test_pid=`ps -auxw | grep "${name}" | awk '{print $2}'` if [ "$test_pid" -gt 0 ]; then kill -s HUP "$test_pid" else echo "${name} not running?" fi fi > G'luck, > Peter > > -- > Peter Pentchev roam@ringlet.net roam@cnsys.bg roam@FreeBSD.org > PGP key: http://people.FreeBSD.org/~roam/roam.key.asc > Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 > If I were you, who would be reading this sentence? Paul Schmehl (pauls@utdallas.edu) Adjunct Information Security Officer The University of Texas at Dallas AVIEN Founding Member http://www.utdallas.edu/ir/security/