From owner-freebsd-rc@FreeBSD.ORG Thu Jul 21 23:11:04 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 9E5C716A420 for ; Thu, 21 Jul 2005 23:11:04 +0000 (GMT) (envelope-from pauls@utdallas.edu) Received: from smtp1.utdallas.edu (smtp1.utdallas.edu [129.110.10.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id 763BA43D9D for ; Thu, 21 Jul 2005 23:10:46 +0000 (GMT) (envelope-from pauls@utdallas.edu) Received: from utd59514.utdallas.edu (utd59514.utdallas.edu [129.110.3.28]) by smtp1.utdallas.edu (Postfix) with ESMTP id C596B388C8B for ; Thu, 21 Jul 2005 18:10:45 -0500 (CDT) Date: Thu, 21 Jul 2005 18:10:45 -0500 From: Paul Schmehl To: freebsd-rc@freebsd.org Message-ID: In-Reply-To: <20050721230123.GA19090@odin.ac.hmc.edu> References: <468B58E789145A1C6885EA66@utd59514.utdallas.edu> <20050721230123.GA19090@odin.ac.hmc.edu> 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 Subject: Re: New port startup script fails 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, 21 Jul 2005 23:11:04 -0000 --On Thursday, July 21, 2005 16:01:23 -0700 Brooks Davis wrote: > On Thu, Jul 21, 2005 at 05:50:12PM -0500, Paul Schmehl wrote: >> I'm working on a new port, and I decided to use the new rc.subr type >> startup script. After I wrote the script, I started testing it. The >> program started fine, but neither stop nor status worked. I read man >> (8) rc.subr and studied the script (/etc/rc.subr). >> >> The program was creating a pid file with the correct name in /var/run, >> but for some reason, the stop and status commands apparently couldn't >> find? read? the file. Is there a way to troubleshoot this problem to >> pin down exactly were the problem is? > > Far too many things could be wrong for us to do more than speculate. > Please send the script in question. > Here it is: (%%SGUILDIR%% is converted to sguil-server in the Makefile) #!/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: %%PREFIX%%/etc/%%SGUILDIR%%/sguild.conf # . %%RC_SUBR%% name="sguild" rcvar=`set_rcvar` command="%%PREFIX%%/bin/%%SGUILDIR%%/sguild" load_rc_config $name [ -z "$sguild_enable" ] && sguild_enable="NO" [ -z "$sguild_conf" ] && sguild_conf="%%PREFIX%%/etc/%%SGUILDIR%%/sguild.conf" [ -z "$sguild_flags" ] && sguild_flags="-D" [ -n "$sguild_conf" ] && sguild_flags="$sguild_flags -c $sguild_conf" run_rc_command "$1" > A couple of ideas. First, are you setting the pidfile variable? No. I can, but by default it is set to /var/run/sguild.pid. > If not, you may need to. Since $name is sguild, wouldn't the pid be sguild.pid? > Second, does the program in question change it's > name? If so, you may have to implement stop and status by hand. I'm not sure I understand what you mean here. However, there *is* one oddity. When the program is running, ps shows the command to be "tclsh8.4 /usr/local/bin/sguil-server/sguild -D -c /usr/local/etc/sguil-server/sguild.conf". Maybe that's the problem? (I thought, since the pidfile was known that it wouldn't matter.) Paul Schmehl (pauls@utdallas.edu) Adjunct Information Security Officer University of Texas at Dallas AVIEN Founding Member http://www.utdallas.edu/ir/security/