Help With rc.d Script -- SOLVED

Paul Schmehl pauls at utdallas.edu
Thu Jun 11 22:07:49 UTC 2009


--On Thursday, June 11, 2009 08:45:59 -0500 Drew Tomlinson 
<drew at mykitchentable.net> wrote:
>
> The problem here is that urchinctl does not write a pid file by default
> and I can't figure out how to make it do so.
>
> However in reading man rc.subr, I found argument_cmd that works for me.
> By setting argument_cmd, I can override the default methods called by
> run_rc_command.  Thus I set these three lines:
>
> start_cmd="/usr/local/urchin/bin/urchinctl start"
> stop_cmd="/usr/local/urchin/bin/urchinctl stop"
> status_cmd="/usr/local/urchin/bin/urchinctl status"
>
> Originally, I used "$1" instead of start, stop, and status.  However
> this had the effect of making "restart" restart twice, once for the
> start method and once for the stop method because
> "/usr/local/urchin/bin/urchinctl restart" was being run each time.
>
>> If that does work, your script should at least be able to report the
>> status (running or not).
>
> I also had to set the procname variable to make the status method
> available.  In my case, it didn't matter to what it was set as the
> urchinctl command handled the actual status reporting.
>
>> I'm assuming that, because root is running the lowest numbered
>> process, killing that process will kill all the children as well.
> Killing the root process killed all the urchinwebd processes but left
> the urchind processes hanging around.  But no matter, I got things working.
>

Drew, I'm glad you were able to get it working.  There may be a way to kill the 
urchind processes as well.   If you set procname to urchin, the rc.subr script 
might understand that to mean any process that begins with that string.  I 
haven't tested it, but looking at the script (/etc/rc.subr), it appears to me 
to be the case.  If that doesn't work, perhaps procname urchin* would.

-- 
Paul Schmehl (pauls at utdallas.edu)
Senior Information Security Analyst
The University of Texas at Dallas
http://www.utdallas.edu/ir/security/


More information about the freebsd-questions mailing list