|
|
@ -1,40 +1,34 @@ |
|
|
|
#!/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 |
|
|
|
|
|
|
|
config_file=/etc/bind/named.conf |
|
|
|
pid_file=/var/run/named/named.pid |
|
|
|
|
|
|
|
start() { |
|
|
|
if [ -e $pid_file ] |
|
|
|
then |
|
|
|
echo " named already running with PID `cat $pid_file`" |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
echo Starting isc-bind |
|
|
|
|
|
|
|
/usr/sbin/named -c $config_file |
|
|
|
logdir=/var/log/named/ |
|
|
|
cachedir=/var/cache/bind |
|
|
|
libdir=/var/lib/bind |
|
|
|
config_file=/etc/bind/named.conf |
|
|
|
|
|
|
|
if [ $? -ne 0 ] |
|
|
|
then |
|
|
|
echo " isc-bind failed to start" |
|
|
|
fi |
|
|
|
fix_perms() { |
|
|
|
for dir in $libdir $logdir $cachedir; do |
|
|
|
test -e "$dir" || { |
|
|
|
mkdir -p "$dir" |
|
|
|
chgrp bind "$dir" |
|
|
|
chmod g+w "$dir" |
|
|
|
} |
|
|
|
done |
|
|
|
} |
|
|
|
|
|
|
|
stop() { |
|
|
|
echo "Stopping isc-bind" |
|
|
|
if [ -e $pid_file ] |
|
|
|
then |
|
|
|
kill `cat $pid_file` |
|
|
|
|
|
|
|
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 |
|
|
|
start_service() { |
|
|
|
fix_perms |
|
|
|
procd_open_instance |
|
|
|
procd_set_param command /usr/sbin/named -u bind -f -c $config_file |
|
|
|
procd_set_param respawn |
|
|
|
procd_close_instance |
|
|
|
} |