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 # Source function library.
13 . /etc/rc.d/init.d/functions
15 pidfile="/var/unbound/unbound.pid"
17 [ -e /etc/sysconfig/unbound ] && . /etc/sysconfig/unbound
19 lockfile=/var/lock/subsys/unbound
22 [ -x /usr/sbin/unbound ] || exit 5
23 [ -f /etc/unbound/unbound.conf ] || exit 6
24 echo -n $"Starting unbound: "
27 if [ -s /etc/localtime ]; then
28 [ -d /var/lib/unbound/etc ] || mkdir -p /var/lib/unbound/etc ;
29 if [ ! -e /var/lib/unbound/etc/localtime ] || /usr/bin/cmp -s /etc/localtime /var/lib/unbound/etc/localtime; then
30 cp -fp /etc/localtime /var/lib/unbound/etc/localtime
33 if [ -s /etc/resolv.conf ]; then
34 [ -d /var/lib/unbound/etc ] || mkdir -p /var/lib/unbound/etc ;
35 if [ ! -e /var/lib/unbound/etc/resolv.conf ] || /usr/bin/cmp -s /etc/resolv.conf /var/lib/unbound/etc/resolv.conf; then
36 cp -fp /etc/resolv.conf /var/lib/unbound/etc/resolv.conf
39 if ! egrep -q '^/[^[:space:]]+[[:space:]]+'/var/lib/unbound'/dev/log' /proc/mounts; then
40 [ -d /var/lib/unbound/dev ] || mkdir -p /var/lib/unbound/dev ;
41 [ -e /var/lib/unbound/dev/log ] || touch /var/lib/unbound/dev/log
42 mount --bind -n /dev/log /var/lib/unbound/dev/log >/dev/null 2>&1;
44 if ! egrep -q '^/[^[:space:]]+[[:space:]]+'/var/lib/unbound'/dev/random' /proc/mounts; then
45 [ -d /var/lib/unbound/dev ] || mkdir -p /var/lib/unbound/dev ;
46 [ -e /var/lib/unbound/dev/random ] || touch /var/lib/unbound/dev/random
47 mount --bind -n /dev/random /var/lib/unbound/dev/random >/dev/null 2>&1;
50 # if not running, start it up here
51 daemon /usr/sbin/unbound
54 [ $retval -eq 0 ] && touch $lockfile
59 echo -n $"Stopping unbound: "
60 # stop it here, often "killproc unbound"
61 killproc -p $pidfile unbound
64 [ $retval -eq 0 ] && rm -f $lockfile
65 if egrep -q '^/[^[:space:]]+[[:space:]]+'/var/lib/unbound'/dev/log' /proc/mounts; then
66 umount /var/lib/unbound/dev/log >/dev/null 2>&1
68 if egrep -q '^/[^[:space:]]+[[:space:]]+'/var/lib/unbound'/dev/random' /proc/mounts; then
69 umount /var/lib/unbound/dev/random >/dev/null 2>&1
80 kill -HUP `cat $pidfile`
88 # run checks to determine if the service is running or use generic status
89 status -p $pidfile unbound
93 rh_status -p $pidfile >/dev/null 2>&1
102 rh_status_q || exit 0
109 rh_status_q || exit 7
118 condrestart|try-restart)
119 rh_status_q || exit 0
123 echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"