Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Nov 2017 10:50:00 -0500
From:      Ernie Luzar <luzar722@gmail.com>
To:        Ian Smith <smithi@nimnet.asn.au>
Cc:        krad <kraduk@gmail.com>,  FreeBSD Questions <freebsd-questions@freebsd.org>, Polytropon <freebsd@edvax.de>, edgar <edgar@pettijohn-web.com>
Subject:   Re: Need help with rc.d script
Message-ID:  <5A05CAA8.8040607@gmail.com>
In-Reply-To: <20171110211228.O72828@sola.nimnet.asn.au>
References:  <mailman.444.1510052978.1530.freebsd-questions@freebsd.org> <20171108021900.W9710@sola.nimnet.asn.au> <CALfReyfuTFH25fAcG=CEL=p0XNyfQVVNi0EGxFwS-Ddv3QWY3A@mail.gmail.com> <5A0481AE.7050504@gmail.com> <20171110211228.O72828@sola.nimnet.asn.au>

next in thread | previous in thread | raw e-mail | index | archive | help
As I review the different methods tried to make my simple sh script 
function using the rc.d framework seems to resulted in 2 different 
methods coming to light.

Method 1.
Use of the daemon command in the rc.d script. This is the method we 
ended up getting to work. It needed no special codding in the base 
script IE: ( ... ), &, or the creation and or population of the scripts 
running pid file.

Method 2.
The use of the rc.d framework defaults which we were never able to get 
working. Speculation about the base script needing special codding
IE: ( ... ), &, or the creation and or population of the scripts running 
pid file.

This method is used by most all the ports that use the rc.d framework.

So I ask the question, why could we NOT get method 2 working. I am of 
the opinion that both methods should have worked. Are we missing 
something so obvious that its staring us in the face and we can not see it.

The handbook rc.d section does not point out any difference in handling 
scripts or compiled programs, or anything about the pid file having to 
be manually manipulated. The result meaning from reading the handbook 
rc.d section is the rc.d framework is designed to automatically handle 
the pid file manipulation.

If this is really not ture, then the handbook rc.d section has very 
large hole in its documentation.

I believe we should continual working on getting method 2 working so we 
all learn how rc.d really works and if need be submit a update to the 
handbook rc.d documentation to give the reader a clearer picture of what 
needs to be done to use the rc.d framework for a sh script.

https://www.freebsd.org/doc/en_US.ISO8859-1/articles/rc-scripting/rcng-daemon.html 

This talks about setting the command_interpreter variable for 
executable scripts. I tested using the testloop rc.d script posted 
previously with  command_interpreter="/bin/sh" and a second time with 
command_interpreter="sh" and in both cases no pid file was created.

Our combined knowledge and experience has so far not been able to come 
up with a solution to use the default rc.d framework to start a normal 
executable sh script as a daemon without using the daemon command 
explicitly. I think it is time to draw on other people in the community 
who we may know who has more rc.d experience to assess us. If you have 
someone in mind please email this post to them so they can read the 
complete thread and hopefully come up with an answer.


Other reading I have done.
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-rcd.html
https://www.freebsd.org/doc/en/books/porters-handbook/rc-scripts.html
https://www.freebsd.org/doc/en_US.ISO8859-1/articles/rc-scripting/
http://www.mewburn.net/luke/papers/rc.d.pdf





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5A05CAA8.8040607>