rc.subr questions - continued
Ian Lepore
freebsd at damnhippie.dyndns.org
Mon Dec 17 18:30:42 UTC 2012
On Mon, 2012-12-17 at 11:43 -0600, Paul Schmehl wrote:
> --On December 17, 2012 10:17:12 AM -0700 Ian Lepore
> <freebsd at damnhippie.dyndns.org> wrote:
>
> > 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:
> >
> > 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
> >
>
> Unfortunately, that doesn't work for me. Here's the current script:
>
> . /etc/rc.subr
>
> name="sguild"
> load_rc_config ${name}
> # set some defaults
> sguild_enable=${sguild_enable:-"NO"}
> sguild_conf=${sguild_conf:-"/usr/local/etc/sguild/sguild.conf"}
> sguild_pid=${sguild_pid:-"/var/run/sguild/sguild.pid"}
> sguild_flags=${sguild_flags:-"-D -P ${sguild_pid}"}
> sguild_user=${sguild_user:-"sguil"}
>
> command="/usr/local/bin/${name}"
> command_args="-c ${sguild_conf} ${sguild_flags}"
> procname="/usr/local/bin/tclsh8.5"
> start_cmd="sguild_start"
>
> sguild_start(){
> echo "starting sguild."
> /bin/sh ${command} ${command_args}
> }
>
> run_rc_command "$1"
>
> When I run start, I get this:
>
> # /usr/local/etc/rc.d/sguild start
> starting sguild.
> /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)
>
> Status and stop work fine.
>
> The "unknown directive is coming from line 913 in rc.subr:
> echo 1>&2 "$0: unknown directive '$rc_arg'."
> rc_usage $_keywords
> # not reached
>
> rc_arg is (fast|force|one|quiet)(start|stop|restart|rcvar|status|poll).
>
> This error:
> /usr/local/etc/rc.d/sguild: unknown directive '/usr/local/bin/sguild'.
>
> Seems to indicate that the rc.subr script thinks $0 is
> /usr/local/bin/sguild rather than /usr/local/etc/rc.d/sguild, which is odd
> to me.
>
>
Does running with rc_debug=YES provide any extra clues?
-- Ian
More information about the freebsd-rc
mailing list