]>
git.saurik.com Git - apple/network_cmds.git/blob - unbound/contrib/unbound.init
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.
11 # Provides: $named unbound
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"
26 config
="/var/unbound/unbound.conf"
27 pidfile
="/var/unbound/unbound.pid"
28 rootdir
="/var/unbound"
30 [ -e /etc
/sysconfig
/$prog ] && .
/etc
/sysconfig
/$prog
32 lockfile
=/var
/lock
/subsys
/$prog
35 [ -x $exec ] || exit 5
36 [ -f $config ] || exit 6
37 echo -n $
"Starting $prog: "
40 if [ -s /etc
/localtime
]; then
41 [ -d ${rootdir}/etc
] || mkdir -p ${rootdir}/etc
;
42 if [ ! -e ${rootdir}/etc
/localtime
] || /usr
/bin
/cmp -s /etc
/localtime
${rootdir}/etc
/localtime
; then
43 cp -fp /etc
/localtime
${rootdir}/etc
/localtime
46 if [ -s /etc
/resolv.conf
]; then
47 [ -d ${rootdir}/etc
] || mkdir -p ${rootdir}/etc
;
48 if [ ! -e ${rootdir}/etc
/resolv.conf
] || /usr
/bin
/cmp -s /etc
/resolv.conf
${rootdir}/etc
/resolv.conf
; then
49 cp -fp /etc
/resolv.conf
${rootdir}/etc
/resolv.conf
52 if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/log' /proc
/mounts
; then
53 [ -d ${rootdir}/dev
] || mkdir -p ${rootdir}/dev
;
54 [ -e ${rootdir}/dev
/log
] || touch ${rootdir}/dev
/log
55 mount
--bind -n /dev
/log
${rootdir}/dev
/log
>/dev
/null
2>&1;
57 if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/random' /proc
/mounts
; then
58 [ -d ${rootdir}/dev
] || mkdir -p ${rootdir}/dev
;
59 [ -e ${rootdir}/dev
/random
] || touch ${rootdir}/dev
/random
60 mount
--bind -n /dev
/random
${rootdir}/dev
/random
>/dev
/null
2>&1;
63 # if not running, start it up here
67 [ $retval -eq 0 ] && touch $lockfile
72 echo -n $
"Stopping $prog: "
73 # stop it here, often "killproc $prog"
74 killproc
-p $pidfile $prog
77 [ $retval -eq 0 ] && rm -f $lockfile
78 if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/log' /proc
/mounts
; then
79 umount
${rootdir}/dev
/log
>/dev
/null
2>&1
81 if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/random' /proc
/mounts
; then
82 umount
${rootdir}/dev
/random
>/dev
/null
2>&1
93 kill -HUP `cat $pidfile`
101 # run checks to determine if the service is running or use generic status
102 status
-p $pidfile $prog
106 rh_status
-p $pidfile >/dev
/null
2>&1
111 rh_status_q
&& exit 0
115 rh_status_q
|| exit 0
122 rh_status_q
|| exit 7
131 condrestart
|try
-restart)
132 rh_status_q
|| exit 0
136 echo $
"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"