#!/bin/sh # # unbound This shell script takes care of starting and stopping # unbound (DNS server). # # chkconfig: 345 14 89 # # description: unbound (BIND) is a Domain Name Server (DNS) \ # that is used to resolve host names to IP addresses. # Source function library . /etc/rc.d/init.d/functions # Source networking configuration . /etc/sysconfig/network UNBOUND_OPT="" # Try get config.. [ -f /etc/sysconfig/unbound ] && . /etc/sysconfig/unbound # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then msg_network_down "Unbound" exit 1 fi else exit 0 fi # Sanity check [ -e /etc/unbound/unbound.conf ] || exit 0 start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/unbound ]; then msg_starting "Unbound" daemon /usr/sbin/unbound \ -c /etc/unbound/unbound.conf $UNBOUND_OPT /dev/null 2>&1 else msg_not_running "Unbound" fi } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status unbound RETVAL=$? if [ -f /etc/rndc.conf ]; then /usr/sbin/rndc status RET=$? if [ $RET -ne 0 ]; then RETVAL=$RET fi fi ;; reload|force-reload) if [ -f /var/lock/subsys/unbound ]; then if [ -f /etc/rndc.conf ]; then run_cmd "$(nls 'Reloading %s service' 'Unbound')" /usr/sbin/rndc reload else msg_reloading "Unbound" killproc unbound -HUP RETVAL=$? fi else msg_not_running "Unbound" exit 7 fi ;; restart) stop start ;; *) msg_usage "$0 {start|stop|restart|reload|force-reload|status}" exit 3 esac exit $RETVAL