Question about rc-scripts

Philip M. Gollucci philip at
Mon Oct 8 18:22:29 PDT 2007

> Again, I thought the rc.subr functions took care of all that for you
> (unless you wanted something special from those commands).
In general, they do
see /etc/rc.subr:

Most binaries i.e. httpd, memcached, mysqld, etc... provide a config 
file or cli option to provide the path to a pid file.
If you look in the ports tree a lot of the patches are putting this in 
the appropriate location: /var/run

The rc.subr then just uses them.

In general this system is very flexible.  It breaks down if you wanted 
to run say 2 distinct memcached daemons on different ports with 
different pid files
via the /usr/local/etc/rc.d/<script>

> I've posted the script (changed quite a lot from vendor supplied) at:

Your particular problem is that run_rc_command actually exists so that 
the script exists with the correct return code generally that of what 
the application
in question returns from trying to start or stop.

Inless you have a reason, If you're running a daemon, you shouldn't need 
to background the command.

Also, rather then an echo try adding -x to the shebang line.

More information about the freebsd-questions mailing list