dns/nsd RC script patch
Darren Pilgrim
list_freebsd at bluerosetech.com
Tue Sep 11 23:20:53 UTC 2012
Jaap Akkerhuis asked that I post here for discussion of a patch I
emailed to him for the NSD port. The patch is question may be found here:
http://shibboleet.com/files_nsd.in.patch.txt
The patch adds the ability to run multiple NSD instances using an eval
hack I originally saw in the isc-dhcpd RC script.
Changes:
- Introduce a new RC variable, ${name}_conf, which defaults to the
current, built-in value (%%PREFIX%%/etc/nsd/nsd.conf) for the base case;
- Add extra RC commands for the notify, patch, rebuild and update nsdc
commands.
The "added complexity" is two parts:
1. Add logic to get the basename used to invoke the script and rename
nsd_enable and nsd_conf to match.
2. Make the RC script the single point of control for NSD instances.
Add the rest of the nsdc commands to the RC script's extra_commands.
Remembering which config file is which instance might be bothersome, so
instead of doing:
nsdc -c /usr/local/etc/nsdfoo.conf rebuild
You can now just do:
/usr/local/etc/rc.d/nsdfoo rebuild
Adding an instance named "nsdfoo":
1. Create the NSD config (default is /usr/local/etc/nsd/nsdfoo.conf).
It will need a separate pidfile, database, difffile and xfrdfile. You
should also have separate zonesdir locations, but they can be shared in
some cases.
2. Add 'nsdfoo_enable="YES"' to /etc/rc.conf.
3. cd /usr/local/etc/rc.d && ln -s nsd nsdfoo
4. /usr/local/etc/rc.d/nsdfoo start
If you don't want to keep all your instance configs in the same
directory (or just not follow the default naming), then replace step 2 with:
2. Add 'nsdfoo_conf="/path/to/conf"' and 'nsdfoo_enable="YES"' to
/etc/rc.conf.
More information about the freebsd-rc
mailing list