Need help with rc.d script

Ernie Luzar luzar722 at
Fri Nov 10 15:50:05 UTC 2017

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. 

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.

More information about the freebsd-questions mailing list