From owner-freebsd-rc@FreeBSD.ORG Mon Jul 18 11:02:26 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 53F7516A41F for ; Mon, 18 Jul 2005 11:02:26 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 26C1943D45 for ; Mon, 18 Jul 2005 11:02:26 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j6IB2QXp098290 for ; Mon, 18 Jul 2005 11:02:26 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j6IB2OWK098284 for freebsd-rc@freebsd.org; Mon, 18 Jul 2005 11:02:24 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 18 Jul 2005 11:02:24 GMT Message-Id: <200507181102.j6IB2OWK098284@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-rc@FreeBSD.org Cc: Subject: Current problem reports assigned to you 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: Mon, 18 Jul 2005 11:02:26 -0000 Current FreeBSD problem reports Critical problems Serious problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2005/02/10] conf/77340 rc awk used in /etc/rc.d/nsswitch when not a 1 problem total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2004/06/30] conf/68525 rc Loader's verbose boot mode has rc.d/local o [2004/07/07] conf/68745 rc /etc/rc.d/devfs runs after ntpd so links o [2005/05/14] kern/81006 rc ipnat not working with tunnel interfaces 3 problems total. From owner-freebsd-rc@FreeBSD.ORG Thu Jul 21 22:50:13 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 7B09716A446 for ; Thu, 21 Jul 2005 22:50:13 +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 4553043D46 for ; Thu, 21 Jul 2005 22:50:13 +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 666FB388D07 for ; Thu, 21 Jul 2005 17:50:12 -0500 (CDT) Date: Thu, 21 Jul 2005 17:50:12 -0500 From: Paul Schmehl To: freebsd-rc@freebsd.org Message-ID: <468B58E789145A1C6885EA66@utd59514.utdallas.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: 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 22:50:13 -0000 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? Paul Schmehl (pauls@utdallas.edu) Adjunct Information Security Officer University of Texas at Dallas AVIEN Founding Member http://www.utdallas.edu/ir/security/ From owner-freebsd-rc@FreeBSD.ORG Thu Jul 21 23:01:30 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 548B716A42C for ; Thu, 21 Jul 2005 23:01:30 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4185743D6E for ; Thu, 21 Jul 2005 23:01:29 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id j6LN1NdD020979; Thu, 21 Jul 2005 16:01:23 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id j6LN1N98020978; Thu, 21 Jul 2005 16:01:23 -0700 Date: Thu, 21 Jul 2005 16:01:23 -0700 From: Brooks Davis To: Paul Schmehl Message-ID: <20050721230123.GA19090@odin.ac.hmc.edu> References: <468B58E789145A1C6885EA66@utd59514.utdallas.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline In-Reply-To: <468B58E789145A1C6885EA66@utd59514.utdallas.edu> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu Cc: freebsd-rc@freebsd.org 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:01:30 -0000 --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=20 > startup script. After I wrote the script, I started testing it. The=20 > program started fine, but neither stop nor status worked. I read man (8)= =20 > rc.subr and studied the script (/etc/rc.subr). >=20 > The program was creating a pid file with the correct name in /var/run, bu= t=20 > for some reason, the stop and status commands apparently couldn't find?= =20 > read? the file. Is there a way to troubleshoot this problem to pin down= =20 > 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. A couple of ideas. First, are you setting the pidfile variable? If not, you may need to. Second, does the program in question change it's name? If so, you may have to implement stop and status by hand. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --EVF5PPMfhYS0aIcm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFC4ClCXY6L6fI4GtQRApjdAJ435s7AOaHNW9N9FkWgHln1TUShdwCdFHI6 6wQ17Bb7lstgl3Tn3IBM6TI= =ZzbY -----END PGP SIGNATURE----- --EVF5PPMfhYS0aIcm-- 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/ From owner-freebsd-rc@FreeBSD.ORG Fri Jul 22 00:45:50 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 74B8916A49C for ; Fri, 22 Jul 2005 00:45:50 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id AF59543E36 for ; Fri, 22 Jul 2005 00:45:25 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id j6M0imBO001210; Thu, 21 Jul 2005 17:44:48 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id j6M0imZZ001209; Thu, 21 Jul 2005 17:44:48 -0700 Date: Thu, 21 Jul 2005 17:44:48 -0700 From: Brooks Davis To: Paul Schmehl Message-ID: <20050722004448.GB19090@odin.ac.hmc.edu> References: <468B58E789145A1C6885EA66@utd59514.utdallas.edu> <20050721230123.GA19090@odin.ac.hmc.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="61jdw2sOBCFtR2d/" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu Cc: freebsd-rc@freebsd.org 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: Fri, 22 Jul 2005 00:45:50 -0000 --61jdw2sOBCFtR2d/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 21, 2005 at 06:10:45PM -0500, Paul Schmehl wrote: > --On Thursday, July 21, 2005 16:01:23 -0700 Brooks Davis=20 > wrote: >=20 > >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) >=20 > #!/bin/sh >=20 > # PROVIDE: sguild > # REQUIRE: DAEMON > # BEFORE: LOGIN > # KEYWORD: FreeBSD shutdown >=20 > # 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:=20 > %%PREFIX%%/etc/%%SGUILDIR%%/sguild.conf > # >=20 > . %%RC_SUBR%% >=20 > name=3D"sguild" > rcvar=3D`set_rcvar` >=20 > command=3D"%%PREFIX%%/bin/%%SGUILDIR%%/sguild" >=20 > load_rc_config $name >=20 > [ -z "$sguild_enable" ] && sguild_enable=3D"NO" > [ -z "$sguild_conf" ] &&=20 > sguild_conf=3D"%%PREFIX%%/etc/%%SGUILDIR%%/sguild.conf" > [ -z "$sguild_flags" ] && sguild_flags=3D"-D" >=20 > [ -n "$sguild_conf" ] && sguild_flags=3D"$sguild_flags -c $sguild_co= nf" >=20 > run_rc_command "$1" Looks mostly good. You can use shell default values instead of the test -z stuff to set the variables if you want: sguild_enable=3D${sguild_enable:-NO} > >A couple of ideas. First, are you setting the pidfile variable? >=20 > No. I can, but by default it is set to /var/run/sguild.pid. >=20 > > If not, you may need to. >=20 > Since $name is sguild, wouldn't the pid be sguild.pid? No, you have to set it since rc.subr supports commands without pid files. > > Second, does the program in question change it's > >name? If so, you may have to implement stop and status by hand. >=20 > I'm not sure I understand what you mean here. However, there *is* one=20 > oddity. When the program is running, ps shows the command to be "tclsh8.= 4=20 > /usr/local/bin/sguil-server/sguild -D -c=20 > /usr/local/etc/sguil-server/sguild.conf". >=20 > Maybe that's the problem? (I thought, since the pidfile was known that i= t=20 > wouldn't matter.) It's sort of both. The rc.subr framework only kills processing with the right name and the right pid (iff the pidfile is given) so that innocent processes aren't killed off with there are leftover PID files. I looked at rc.subr and realized that there is support for interpreted commands, but you have to enable it by setting command_interpreter. I'm not quite sure what to set it to. It looks like the value is mostly ignored, but I'm not 100% sure. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --61jdw2sOBCFtR2d/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFC4EGAXY6L6fI4GtQRAlQOAKCnLt5hykxN6XQCTG399MWEi/Cx7wCg57Xn gPlkYzChYEoKKfsD/m0SWzA= =gQI8 -----END PGP SIGNATURE----- --61jdw2sOBCFtR2d/-- From owner-freebsd-rc@FreeBSD.ORG Fri Jul 22 02:28:55 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 C75FC16A44B for ; Fri, 22 Jul 2005 02:28:55 +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 AFFEF43D5C for ; Fri, 22 Jul 2005 02:28:43 +0000 (GMT) (envelope-from pauls@utdallas.edu) Received: from [192.168.2.101] (adsl-66-137-148-66.dsl.rcsntx.swbell.net [66.137.148.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.stovebolt.com (Postfix) with ESMTP id 0C6773FC41 for ; Thu, 21 Jul 2005 21:28:38 -0500 (CDT) Date: Thu, 21 Jul 2005 21:28:17 -0500 From: Paul Schmehl To: freebsd-rc@freebsd.org Message-ID: <934769257EAE1C5FD99FD7E3@Paul-Schmehls-Computer.local> In-Reply-To: <20050722004448.GB19090@odin.ac.hmc.edu> References: <468B58E789145A1C6885EA66@utd59514.utdallas.edu> <20050721230123.GA19090@odin.ac.hmc.edu> <20050722004448.GB19090@odin.ac.hmc.edu> 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: Fri, 22 Jul 2005 02:28:56 -0000 Thanks. I haven't got it working yet, but I'll figure it out. --On July 21, 2005 5:44:48 PM -0700 Brooks Davis wrote: > On Thu, Jul 21, 2005 at 06:10:45PM -0500, Paul Schmehl wrote: >> --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" > > Looks mostly good. You can use shell default values instead of the test > -z stuff to set the variables if you want: > > sguild_enable=${sguild_enable:-NO} > >> > 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? > > No, you have to set it since rc.subr supports commands without pid > files. > >> > 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.) > > It's sort of both. The rc.subr framework only kills processing with the > right name and the right pid (iff the pidfile is given) so that innocent > processes aren't killed off with there are leftover PID files. I looked > at rc.subr and realized that there is support for interpreted commands, > but you have to enable it by setting command_interpreter. I'm not quite > sure what to set it to. It looks like the value is mostly ignored, but > I'm not 100% sure. > > -- Brooks > > -- > Any statement of the form "X is the one, true Y" is FALSE. > PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 Paul Schmehl (pauls@utdallas.edu) Adjunct Information Security Officer University of Texas at Dallas AVIEN Founding Member http://www.utdallas.edu/ From owner-freebsd-rc@FreeBSD.ORG Sat Jul 23 15:13:36 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 150AD16A41F for ; Sat, 23 Jul 2005 15:13:36 +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 BBB2543D49 for ; Sat, 23 Jul 2005 15:13:35 +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 77F8D3FC38 for ; Sat, 23 Jul 2005 10:13:30 -0500 (CDT) Date: Sat, 23 Jul 2005 10:13:10 -0500 From: Paul Schmehl To: freebsd-rc@freebsd.org Message-ID: In-Reply-To: <20050723122634.GA1024@rogue.smit.lan> References: <468B58E789145A1C6885EA66@utd59514.utdallas.edu> <20050721230123. GA19090@odin.ac.hmc.edu> <20050723122634.GA1024@rogue.smit.lan> 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 15:13:36 -0000 --On July 23, 2005 3:26:35 PM +0300 Mike Makonnen wrote: > On Thu, Jul 21, 2005 at 06:10:45PM -0500, Paul Schmehl wrote: >> >> 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.) >> > > If the command you're starting up is a shell script then you need to set > command_interpreter=yes in your script. In such a case rc.subr(8) will > read the first line of $command and figure out what the interpreter is > and modify the ps(1) string to look for appropriately. And yes, you need > to define $pidfile as well. > I tried using command_interpreter=yes, but I got errors: can't find tclsh8.4 and when I tried adding the full patch, I got errors about ELF?? Paul Schmehl (pauls@utdallas.edu) Adjunct Information Security Officer University of Texas at Dallas AVIEN Founding Member http://www.utdallas.edu/ From owner-freebsd-rc@FreeBSD.ORG Sat Jul 23 15:20:49 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 D14B316A41F for ; Sat, 23 Jul 2005 15:20:49 +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 8092643D46 for ; Sat, 23 Jul 2005 15:20:49 +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 61E093FC37 for ; Sat, 23 Jul 2005 10:20:44 -0500 (CDT) Date: Sat, 23 Jul 2005 10:20:24 -0500 From: Paul Schmehl To: freebsd-rc@freebsd.org Message-ID: <259A02F8B7F426645765EB45@Paul-Schmehls-Computer.local> In-Reply-To: <20050723123349.GB1024@rogue.smit.lan> References: <468B58E789145A1C6885EA66@utd59514.utdallas.edu> <20050721230123. GA19090@odin.ac.hmc.edu> <20 050722004448.GB19090@odin.ac.hmc.edu> <20050723123349.GB1024@rogue.smit.lan> 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 15:20:49 -0000 --On July 23, 2005 3:33:49 PM +0300 Mike Makonnen wrote: > On Thu, Jul 21, 2005 at 05:44:48PM -0700, Brooks Davis wrote: >> >> Looks mostly good. You can use shell default values instead of the test >> -z stuff to set the variables if you want: >> >> sguild_enable=${sguild_enable:-NO} > > The preferred method is: sguild_enable=${sguild_enable-NO} > (note the absence of : ) > > use of ':-' overrides the variable if it's empty or unset, whereas > '-' only overrides if the variable is unset. > 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? Here's the present 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/sguild" pidfile="/var/run/${name}.pid" procname="tclsh8.4" #command_interpreter=yes load_rc_config ${name} sguild_enable=${sguild_enable-NO} sguild_conf=${sguild_conf-/usr/local/etc/sguil-server/sguild.conf} sguild_flags=${sguild_flags--D} [ -n "$sguild_conf" ] && sguild_flags="$sguild_flags -c $sguild_conf" # Hack until run_rc_command() get rid of exit() sguild_stop() { pid=$(check_pidfile ${pidfile} ${procname}) if [ -z ${pid} ]; then echo "${name} not running? (check ${pidfile})." return 1 fi echo "Stopping ${command}." kill -${sig_stop:-TERM} ${pid} [ $? -ne 0 ] && [ -z "$rc_force" ] && return 1 wait_for_pids ${pid} } 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/ 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/