Skip to content

Instantly share code, notes, and snippets.

@MihailoJoksimovic
Created April 27, 2013 14:32
Show Gist options
  • Save MihailoJoksimovic/5473339 to your computer and use it in GitHub Desktop.
Save MihailoJoksimovic/5473339 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# mydns This starts and stops mydns.
#
# chkconfig: - 65 35
# description: A database-driven DNS server
#
# processname: /usr/sbin/mydns
# config: /etc/mydns.conf
# pidfile: /var/run/mydns.pid
PATH=/sbin:/bin:/usr/bin:/usr/local/sbin/
prog=/usr/local/sbin/mydns
# Source function library.
. /etc/init.d/functions
[ -f /usr/local/sbin/mydns ] || exit 1
[ -f /etc/mydns.conf ] || exit 1
RETVAL=0
start(){
echo -n $"Starting $prog: "
daemon $prog -b
RETVAL=$?
echo
touch /var/lock/subsys/mydns
return $RETVAL
}
stop(){
echo -n $"Stopping $prog: "
killproc $prog
RETVAL=$?
echo
rm -f /var/lock/subsys/mydns
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/mydns ] && restart
return 0
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
;;
restart|reload)
restart
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=1
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment