I need help with Script running as a daemon !!!

Brooks Davis brooks at freebsd.org
Tue Feb 6 03:33:47 UTC 2007


On Mon, Feb 05, 2007 at 09:50:08PM -0500, Cwalinski, Zygmunt wrote:
> -----Original Message-----
> From: Brooks Davis [mailto:brooks at freebsd.org] 
> Sent: 05-02-2007 9:31 PM
> To: Cwalinski, Zygmunt
> Cc: Brooks Davis; freebsd-rc at freebsd.org
> Subject: Re: I need help with Script running as a daemon !!!
> 
> [Please don't top-post.  It's considered rude on FreeBSD mailing lists.]
> 
> On Mon, Feb 05, 2007 at 07:10:28PM -0500, Cwalinski, Zygmunt wrote:
> > Dave, 
> > Thanks for your email. I have set execute bit and change the script
> to:
> > 
> > name="runtest"
> > pidfile="/var/run/${name}.pid"
> > rcvar=`set_rcvar`
> > start_cmd=runtest_start
> > command="/etc/runtest"
> > command_interpreter=while
> > load_rc_config $name
> > runtest_enable=${runtest_enable-:NO}
> > 
> > runtest_start() {
> >   $command &
> >   echo $! > ${pidfile}
> > }
> > 
> > I get no error when I start this script but still when I am trying to
> > stop the daemon I am getting the following error:
> > runtest not running? (check /var/run/runtest.pid).
> > 
> > (pidfile contains a correct process ID)
> 
> The value of command_interpreter is bogus.  From your previous
> post, it should probably be /bin/sh.  That shouldn't be fatal in an of
> it self though.  What does "ps auxww | grep `cat /var/run/runtest.pid`"
> say?
> 
> Also, what version of FreeBSD are you running?
> 
> -- Brooks
> 
> [Thanks for your top-post remark]
> I am running FreeBSD 6.2
> 
> When I set "command_interpreter=/bin/sh" I get the following error
> during startup:
> /usr/local/etc/rc.d/runtestd: WARNING: $command_interpreter /bin/sh !=
> while
> (although script is running)
> 
> "ps auxww | grep `cat /var/run/runtest.pid`" says:
> root        1314  0.0  1.1  1836  1396  p1  S     9:38PM   0:00.03
> /bin/sh /usr/local/etc/rc.d/runtestd start
> 
> Here is my current script:
> #!/bin/sh
> . /etc/rc.subr
> # PROVIDE: Test
> # REQUIRE: DAEMON
> # BEFORE: LOGIN
> # KEYWORD: My test
> name="runtest"
> pidfile="/var/run/${name}.pid"
> rcvar=`set_rcvar`
> start_cmd=runtest_start
> command="/etc/runtest"
> command_interpreter=/bin/sh
> 
> load_rc_config $name
> runtest_enable=${runtest_enable-:NO}
> 
> runtest_start() {
>   $command &
>   echo $! > ${pidfile}
> }
> run_rc_command "$1"

If this is the output then /usr/local/etc/rc.d/runtestd should be
command since that's what is actually being run.  What is /etc/runtest?
A symlink?

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-rc/attachments/20070206/627feeb4/attachment.pgp


More information about the freebsd-rc mailing list