1#!/bin/bash
2#
3# mydns        This starts and stops mydns.
4#
5# chkconfig: 345 52 50
6# description: A database-driven DNS server
7#
8# processname: /usr/sbin/mydns
9# config: /etc/mydns.conf
10# pidfile: /var/run/mydns.pid
11
12PATH=/sbin:/bin:/usr/bin:/usr/sbin
13prog=mydns
14
15# Source function library.
16. /etc/init.d/functions
17
18[ -f /usr/sbin/mydns ] || exit 1
19[ -f /etc/mydns.conf ] || exit 1
20
21RETVAL=0
22
23start(){
24    echo -n $"Starting $prog: "
25
26    daemon $prog -b
27    RETVAL=$?
28    echo
29    touch /var/lock/subsys/mydns
30    return $RETVAL
31}
32
33stop(){
34    echo -n $"Stopping $prog: "
35    killproc $prog
36    RETVAL=$?
37    echo
38    rm -f /var/lock/subsys/mydns
39    return $RETVAL
40
41}
42
43restart(){
44    stop
45    start
46}
47
48condrestart(){
49    [ -e /var/lock/subsys/mydns ] && restart
50    return 0
51}
52
53
54# See how we were called.
55case "$1" in
56    start)
57	start
58	;;
59    stop)
60	stop
61	;;
62    status)
63	status $prog
64	;;
65    restart|reload)
66	restart
67	;;
68    condrestart)
69	condrestart
70	;;
71    *)
72	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
73	RETVAL=1
74esac
75
76exit $RETVAL
77
78