+++ /dev/null
-#!/bin/bash
-### BEGIN INIT INFO
-# Provides: dnsdist
-# Required-Start: $network $remote_fs $syslog
-# Required-Stop: $network $remote_fs $syslog
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: dnsdist
-### END INIT INFO
-# chkconfig: 2345 80 75
-# description: dnsdist is a powerful, scriptable DNS loadbalancer
-# processname: dnsdist
-
-# Source function library.
-. /etc/init.d/functions
-
-PROG=dnsdist
-DNSDIST=/usr/bin/${PROG}
-PIDFILE=/var/run/${PROG}.pid
-DNSDIST_USER='dnsdist'
-DNSDIST_GROUP='dnsdist'
-DNSDIST_OPTIONS=""
-
-if [ -f /etc/default/${PROG} ]; then
- . /etc/default/${PROG}
-fi
-
-if [ -f /etc/sysconfig/${PROG} ]; then
- . /etc/sysconfig/${PROG}
-fi
-
-RETVAL=0
-
-do_check() {
- msg=$(${DNSDIST} ${DNSDIST_OPTIONS} --check-config 2>&1)
- if [ $? -ne 0 ]; then
- echo "Error in configuration file:" >&2
- echo "${msg}" >&2
- return 1
- fi
- return 0
-}
-
-do_start() {
- echo -n "Starting ${PROG}..."
- do_check
- if [ $? -ne 0 ]; then
- return 1
- fi
- daemon --pidfile=${PIDFILE} $DNSDIST -u ${DNSDIST_USER} -g ${DNSDIST_GROUP} -d -p ${PIDFILE} ${DNSDIST_OPTIONS}
- ret=$?
- echo
- return $ret
-}
-
-do_stop() {
- echo -n "Stopping ${PROG}..."
- killproc -p ${PIDFILE} -b $DNSDIST $PROG
- ret=$?
- echo
- return $ret
-}
-
-do_status() {
- status -p ${PIDFILE} -b ${DNSDIST} ${PROG}
- return $?
-}
-
-case "$1" in
- start)
- do_start
- RETVAL=$?;;
- stop)
- do_stop
- RETVAL=$?;;
- restart)
- do_status >/dev/null 2>&1
- ret=$?
-
- if [ ${ret} -eq 0 ]; then
- do_check
- if [ $? -ne 0 ]; then
- exit 1 # Don't stop when there's an error
- fi
- do_stop
- fi
-
- do_start
- RETVAL=$?
- ;;
- status)
- do_status
- exit $?
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|status}"
- exit 1
- ;;
-esac
-
-exit $RETVAL