Good example for startup script with multiple "profiles"?

Andrew Thompson andy at fud.org.nz
Wed Feb 10 22:57:07 UTC 2016


On 11 February 2016 at 11:43, Garrett Wollman <wollman at bimajority.org>
wrote:

> It's sometimes useful to have a single rc script start multiple copies
> of the same service, using different options.  (For example, and my
> use case here, running a monitoring daemon with different parameters
> on "inside" and "outside" network interfaces.)  Is there a good
> example I can crib from for how best to code this up while taking
> maximal advantage of the rc.subr framework?
>

Slightly different but the openvpn startup script uses the filename as the
variable prefix and you start multiple copies by linking the file to a new
name. Works well.

# This script supports running multiple instances of openvpn.
# To run additional instances link this script to something like
# % ln -s openvpn openvpn_foo
# and define additional openvpn_foo_* variables in one of
# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/openvpn_foo


Andrew


More information about the freebsd-rc mailing list