From owner-freebsd-rc@FreeBSD.ORG Sat Jul 23 19:56:52 2005 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 24C1116A41F for ; Sat, 23 Jul 2005 19:56:52 +0000 (GMT) (envelope-from pauls@utdallas.edu) Received: from mail.stovebolt.com (mail.stovebolt.com [66.221.101.248]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1D1143D46 for ; Sat, 23 Jul 2005 19:56:51 +0000 (GMT) (envelope-from pauls@utdallas.edu) Received: from [192.168.2.101] (adsl-68-93-60-6.dsl.rcsntx.swbell.net [68.93.60.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.stovebolt.com (Postfix) with ESMTP id 6841A3FC47 for ; Sat, 23 Jul 2005 14:56:46 -0500 (CDT) Date: Sat, 23 Jul 2005 14:56:26 -0500 From: Paul Schmehl To: freebsd-rc@freebsd.org Message-ID: <147A3D76415AF3A50F6C0055@Paul-Schmehls-Computer.local> In-Reply-To: <259A02F8B7F426645765EB45@Paul-Schmehls-Computer.local> References: <468B58E789145A1C6885EA66@utd59514.utdallas.edu> <20050721230123. GA19090@odin.ac.hmc.edu> <20 050722004448.GB19090@odin.ac.hmc.edu> <20050723123349.GB1024@rogue.smit.lan> <259A02F8B7F426645765EB45@Paul-Schmehls-Computer.local> X-Mailer: Mulberry/4.0.0 (Mac OS X) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Re: New port startup script fails X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Paul Schmehl 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: Sat, 23 Jul 2005 19:56:52 -0000 --On July 23, 2005 10:20:24 AM -0500 Paul Schmehl wrote: > --On July 23, 2005 3:33:49 PM +0300 Mike Makonnen wrote: > > Thanks. I made the corrections. The script now works except for one > problem. The tk script spawns two child processes, and when you stop the > parent, the children don't die. Is there a way to solve that problem? > The script now works, including killing the child process. Here's the working script: #!/bin/sh # PROVIDE: sguild # REQUIRE: DAEMON # BEFORE: LOGIN # KEYWORD: FreeBSD shutdown # Add the following lines to /etc/rc.conf to enable sguild: # sguild_enable (bool): Set to YES to enable sguild # Default: NO # sguild_flags (str): Extra flags passed to sguild # Default: -D # sguild_conf (str): Sguild configuration file # Default: /usr/local/etc/sguil-server/sguild.conf # . /etc/rc.subr name="sguild" rcvar=`set_rcvar` command="/usr/local/bin/sguil-server/${name}" procname="tclsh8.4" sguild_enable=${sguild_enable-NO} sguild_conf=${sguild_conf-/usr/local/etc/sguil-server/sguild.conf} sguild_flags=${sguild_flags--D} # Hack until run_rc_command() get rid of exit() sguild_stop() { pids=$(reverse_list $(check_process ${procname} [ /bin/sh ])) if [ -z ${pids} ]; then echo "${name} not running?)." return 1 fi echo "Stopping ${name}." kill -${sig_stop:-TERM} ${pids} [ $? -ne 0 ] && [ -z "$rc_force" ] && return 1 wait_for_pids ${pids} } load_rc_config ${name} run_rc_command "$1" Paul Schmehl (pauls@utdallas.edu) Adjunct Information Security Officer University of Texas at Dallas AVIEN Founding Member http://www.utdallas.edu/