3 # unbound This shell script takes care of starting and stopping
4 # unbound (DNS server).
7 # description: unbound is a Domain Name Server (DNS) \
8 # that is used to resolve host names to IP addresses.
12 # Required-Start: $network $local_fs
13 # Required-Stop: $network $local_fs
14 # Should-Start: $syslog
15 # Should-Stop: $syslog
16 # Short-Description: unbound recursive Domain Name Server.
17 # Description: unbound is a Domain Name Server (DNS)
18 # that is used to resolve host names to IP addresses.
21 # Source function library.
22 . /etc/rc.d/init.d/functions
24 exec="/usr/sbin/unbound"
25 config="/var/lib/unbound/unbound.conf"
26 rootdir="/var/lib/unbound"
27 pidfile="/var/run/unbound/unbound.pid"
29 [ -e /etc/sysconfig/unbound ] && . /etc/sysconfig/unbound
31 lockfile=/var/lock/subsys/unbound
34 [ -x $exec ] || exit 5
35 [ -f $config ] || exit 6
36 echo -n $"Starting unbound: "
38 if [ ! -e ${rootdir}/etc/resolv.conf ] || /usr/bin/cmp -s /etc/resolv.conf ${rootdir}/etc/resolv.conf; then
39 cp -fp /etc/resolv.conf ${rootdir}/etc/resolv.conf
41 if [ ! -e ${rootdir}/etc/localtime ] || /usr/bin/cmp -s /etc/localtime ${rootdir}/etc/localtime; then
42 cp -fp /etc/localtime ${rootdir}/etc/localtime
44 mount --bind -n /dev/log ${rootdir}/dev/log >/dev/null 2>&1;
45 mount --bind -n /dev/random ${rootdir}/dev/random >/dev/null 2>&1;
46 mount --bind -n /var/run/unbound ${rootdir}/var/run/unbound >/dev/null 2>&1;
48 # if not running, start it up here
51 [ $retval -eq 0 ] && touch $lockfile
56 echo -n $"Stopping unbound: "
57 # stop it here, often "killproc unbound"
58 killproc -p $pidfile unbound
60 [ $retval -eq 0 ] && rm -f $lockfile
61 for mountfile in /dev/log /dev/random /etc/localtime /etc/resolv.conf /var/run/unbound
63 if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}''${mountfile}'' /proc/mounts; then
64 umount ${rootdir}$mountfile >/dev/null 2>&1
76 kill -HUP `cat $pidfile`
84 # run checks to determine if the service is running or use generic status
85 status -p $pidfile unbound
89 rh_status -p $pidfile >/dev/null 2>&1
111 condrestart|try-restart)
112 rh_status_q || exit 0
116 echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"