From owner-freebsd-rc@FreeBSD.ORG Mon Dec 17 17:17:17 2012 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B6C02A02 for ; Mon, 17 Dec 2012 17:17:17 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id 364378FC12 for ; Mon, 17 Dec 2012 17:17:16 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id qBHHHF8a032729 for ; Mon, 17 Dec 2012 10:17:15 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id qBHHHDZV063030; Mon, 17 Dec 2012 10:17:13 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Subject: Re: rc.subr questions - continued From: Ian Lepore To: Paul Schmehl In-Reply-To: <8A328288ADDF512269BB31D5@utd71538.campus.ad.utdallas.edu> References: <8A328288ADDF512269BB31D5@utd71538.campus.ad.utdallas.edu> Content-Type: text/plain; charset="us-ascii" Date: Mon, 17 Dec 2012 10:17:12 -0700 Message-ID: <1355764632.1198.162.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-rc@freebsd.org X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.14 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, 17 Dec 2012 17:17:17 -0000 On Mon, 2012-12-17 at 10:50 -0600, Paul Schmehl wrote: > Since I maintain three ports (security/sguil-server, security/sguil-sensor > and security/sguil-client) that have this problem, I decided to start with > the server port. The current port version is 0.7.0 and the init script > worked fine when I submitted the port a while ago. Here it is: > > . /etc/rc.subr > > load_rc_config sguild > # set some defaults > sguild_enable=${sguild_enable:-"NO"} > sguild_conf=${sguild_conf:-"/%%PREFIX%%/etc/%%SGUILDIR%%/sguild.conf"} > pid=${pid:-"/var/run/%%SGUILDIR%%/sguild.pid"} > sguild_flags=${sguild_flags:-"-D -P ${pid}"} > sguild_user=${sguild_user:-"sguil"} > > name="sguild" > rcvar=sguild_enable > command="%%PREFIX%%/bin/${name}" > command_args="-c ${sguild_conf} ${sguild_flags}" > procname="%%TCLSH%%" > check_process="${procname}" > sguild_user="sguil" > > run_rc_command "$1" > > The sguild program begins with these lines: > > #!/bin/sh > # Run tcl from users PATH \ > exec tclsh "$0" "$@" > > Now I'm trying to update to version 0.8.0, and I cannot get the init script > to work. It's identical to the 0.7.0 version, and so is the beginning of > the sguild program. Yet when I try to start the program, I get this: > > # /usr/local/etc/rc.d/sguild start > /usr/local/etc/rc.d/sguild: WARNING: no shebang line in > /usr/local/bin/tclsh8.5 > /usr/local/etc/rc.d/sguild: WARNING: no shebang line in > /usr/local/bin/tclsh8.5 > /usr/local/etc/rc.d/sguild: unknown directive '/usr/local/bin/sguild'. > Usage: /usr/local/etc/rc.d/sguild > [fast|force|one|quiet](start|stop|restart|rcvar|status|poll) > > When I look at /etc/rc.subr, I take the "unknown directive section to mean > "I'm bailing out, because I have no clue what you want me to do." > > I can start the daemon manually, and it works as expected: > > # sh /usr/local/bin/sguild -c /usr/local/etc/sguild/sguild.conf -D -P > /var/run/sguild/sguild.pid > 2012-12-17 16:42:48 pid(77882) Loading access list: > /usr/local/etc/sguild/sguild.access > 2012-12-17 16:42:48 pid(77882) Sensor access list set to ALLOW ANY. > 2012-12-17 16:42:48 pid(77882) Client access list set to ALLOW ANY. > > # ps -auxw | grep sguild > sguil 77884 0.0 0.1 28240 8524 0 I 4:42PM 0:00.02 > /usr/local/bin/tclsh8.5 /usr/local/bin/sguild -c > /usr/local/etc/sguild/sguild.conf -D -P /var/run/sguild/sguild.pid > sguil 77888 0.0 0.1 28240 8392 0 S 4:42PM 0:00.00 > /usr/local/bin/tclsh8.5 /usr/local/bin/sguild -c > /usr/local/etc/sguild/sguild.conf -D -P /var/run/sguild/sguild.pid > sguil 77889 0.0 0.1 28240 8396 0 I 4:42PM 0:00.00 > /usr/local/bin/tclsh8.5 /usr/local/bin/sguild -c > /usr/local/etc/sguild/sguild.conf -D -P /var/run/sguild/sguild.pid > > Both status and stop work fine: > > # /usr/local/etc/rc.d/sguild status > sguild is running as pid 77884 77888 77889. > [root@buttercup4 /usr/ports/security/sguil-server]# > /usr/local/etc/rc.d/sguild stop > Stopping sguild. > SGUILD: killing child procs... > SGUILD: Exiting... > > # ps -auxw | grep sguild > root 77964 0.0 0.0 9128 1452 0 S+ 4:45PM 0:00.00 grep sguild > > This makes no sense to me. What is start failing like this? Did something > change in the rc.subr script recently? I don't see anything in > /usr/ports/CHANGES for rc.subr since 2007. I don't see anything at all > about rc.subr in /usr/ports/UPDATING. > > If I add a command_interpreter of /usr/local/bin/tclsh8.5, status and stop > fail, claiming sguild isn't running. (It is.) > > This one has me stumped. > I can't answer the part about why it used to work and now it doesn't, but in general that doesn't look like a modern rc script that starts and stops a daemon. Someone had a similar problem with a simple solution in the past... http://lists.freebsd.org/pipermail/freebsd-questions/2010-October/222354.html -- Ian