From owner-freebsd-rc@FreeBSD.ORG Thu Feb 2 12:04:20 2006 Return-Path: X-Original-To: freebsd-rc@freebsd.org 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 49DED16A422 for ; Thu, 2 Feb 2006 12:04:20 +0000 (GMT) (envelope-from boris@brooknet.com.au) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 78C6143D5A for ; Thu, 2 Feb 2006 12:04:18 +0000 (GMT) (envelope-from boris@brooknet.com.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout2.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id k12C3aJ0020428; Thu, 2 Feb 2006 23:03:37 +1100 Received: from [61.8.44.18] (ppp2C12.dyn.pacific.net.au [61.8.44.18]) by mailproxy1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id k12C3X76002550; Thu, 2 Feb 2006 23:03:34 +1100 In-Reply-To: <20060202115800.GI29980@comp.chem.msu.su> References: <61138162-C7EB-4DC8-B106-F060D468DE70@brooknet.com.au> <200601291515.47052.flz@xbsd.org> <6BAEAA5C-A4A2-4AD9-A658-A674749B20FF@brooknet.com.au> <20060202115800.GI29980@comp.chem.msu.su> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <5FBC5173-5B69-4CA0-9152-4BF14357E4D8@brooknet.com.au> Content-Transfer-Encoding: 7bit From: Sam Lawrance Date: Thu, 2 Feb 2006 23:03:41 +1100 To: Yar Tikhiy X-Mailer: Apple Mail (2.746.2) Cc: freebsd-rc@freebsd.org Subject: Re: [patch] kill process after a timeout X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 02 Feb 2006 12:04:20 -0000 On 02/02/2006, at 10:58 PM, Yar Tikhiy wrote: > On Mon, Jan 30, 2006 at 10:29:25AM +1100, Sam Lawrance wrote: >> >> On 30/01/2006, at 1:15 AM, Florent Thoumie wrote: >> >>> On Sunday 29 January 2006 14:38, Sam Lawrance wrote: >>>> http://people.freebsd.org/~lawrance/patch-rc.subr >>>> >>>> This patch adds the ${name}_stop_timeout variable. When set, >>>> rather >>>> than simply wait on the PIDS after sending a -TERM signal, they >>>> will >>>> be kill -9'ed after the specified timeout in seconds. >>>> >>>> For example, with a tomcat script I'm working on, I set >>>> jakarta_tomcat41_stop_timeout=10, then >>>> >>>> # sh tomcat41.sh forcestop >>>> Stopping jakarta_tomcat41. >>>> Waiting (max 10 secs) for PIDS: 42864, 42864, 42864, 42864, 42864. >>>> >>>> I need to do something like this anyway with the tomcat rc >>>> scripts, I >>>> figure it might be a useful addition to rc.subr. >>>> >>>> Thoughts? >>> >>> Looks good to me. But I wondered if we really have cases where we >>> don't want >>> to wait with some timeout. I guess I would have modified >>> wait_for_pid to take >>> $name_stop_timeout as a new argument (defaulting to 10, for >>> example) instead >>> of copying wait_for_pid to a new function. >>> >>> My 0.02$ :) >> >> We can't add a new optional argument without changing all the calls >> to it anyway, because it takes a variable of PIDs as arguments: >> >> wait_for_pids pid [pid ...] >> >> I thought it was better to create a new function, just in case there >> are other scripts and ports that use wait_for_pids. > > I wonder why we haven't begun using POSIX getopts in rc.subr functions > yet. Some of them are asking for it. In this case: > > wait_for_pids [-t timeout] pid ... > > Pretty neat, huh? :-) You know, it never even crossed my mind. I'll make some changes and follow up to the PR. Thanks!