bind: Use procd in /etc/init.d/named

Signed-off-by: Noah Meyerhans <frodo@morgul.net>
This commit is contained in:
Noah Meyerhans 2014-11-28 14:35:55 -08:00 committed by Noah Meyerhans
parent 5382c7fc55
commit d3d3f1e57b

View file

@ -1,40 +1,34 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
# Copyright (C) 2014 Noah Meyerhans <frodo@morgul.net>
# Licensed under the terms of the GNU General Public License version 2
# or (at your discretion) any later later version
USE_PROCD=1
START=50 START=50
config_file=/etc/bind/named.conf config_file=/etc/bind/named.conf
pid_file=/var/run/named/named.pid pid_file=/var/run/named/named.pid
start() { logdir=/var/log/named/
if [ -e $pid_file ] cachedir=/var/cache/bind
then libdir=/var/lib/bind
echo " named already running with PID `cat $pid_file`" config_file=/etc/bind/named.conf
return 1
fi
echo Starting isc-bind
/usr/sbin/named -c $config_file fix_perms() {
for dir in $libdir $logdir $cachedir; do
if [ $? -ne 0 ] test -e "$dir" || {
then mkdir -p "$dir"
echo " isc-bind failed to start" chgrp bind "$dir"
fi chmod g+w "$dir"
}
done
} }
stop() { start_service() {
echo "Stopping isc-bind" fix_perms
if [ -e $pid_file ] procd_open_instance
then procd_set_param command /usr/sbin/named -u bind -f -c $config_file
kill `cat $pid_file` procd_set_param respawn
procd_close_instance
if [ $? -ne 0 ]
then
echo " PID " `cat $pid_file` not found
echo " Is the named server running?"
fi
rm -f $pid_file
else
echo " $pid_file not found"
fi
} }