rc.subr questions - continued
Ian Lepore
freebsd at damnhippie.dyndns.org
Mon Dec 17 17:17:17 UTC 2012
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 at 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
More information about the freebsd-rc
mailing list