Date: Mon, 17 Dec 2012 10:17:12 -0700 From: Ian Lepore <freebsd@damnhippie.dyndns.org> To: Paul Schmehl <pschmehl_lists@tx.rr.com> Cc: freebsd-rc@freebsd.org Subject: Re: rc.subr questions - continued Message-ID: <1355764632.1198.162.camel@revolution.hippie.lan> In-Reply-To: <8A328288ADDF512269BB31D5@utd71538.campus.ad.utdallas.edu> References: <DC59D265988CEDF1F3DC5C6D@utd71538.campus.ad.utdallas.edu> <CADLo838ty4_ryGLQo9h5Ze2oA0WXvX3Yc4vV9Ei9HjG0whLkfg@mail.gmail.com> <8A328288ADDF512269BB31D5@utd71538.campus.ad.utdallas.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1355764632.1198.162.camel>