]>
Commit | Line | Data |
---|---|---|
eeb6b95e | 1 | #!/bin/sh |
2 | # | |
3 | # maradns This shell script takes care of starting and stopping | |
4 | # maradns | |
5 | # | |
6 | # chkconfig: 345 14 89 | |
7 | # | |
8 | # description: maradns is a Domain Name Server (DNS) \ | |
9 | # that is used to resolve host names to IP addresses. | |
10 | ||
11 | # Source function library | |
12 | . /etc/rc.d/init.d/functions | |
13 | ||
14 | # Source networking configuration | |
15 | . /etc/sysconfig/network | |
16 | ||
17 | # Check that networking is up. | |
18 | if is_no "${NETWORKING}"; then | |
19 | msg_Network_Down "maraDNS" | |
20 | exit 1 | |
21 | fi | |
22 | ||
23 | # Sanity check | |
24 | [ -e /etc/mararc ] || exit 0 | |
25 | ||
26 | # See how we were called. | |
27 | case "$1" in | |
28 | start) | |
29 | # Check if the service is already running? | |
30 | if [ ! -f /var/lock/subsys/maradns ]; then | |
31 | msg_starting "maraDNS" | |
5020ad06 | 32 | daemon maradns -f /etc/mararc & |
33 | sleep 1 | |
34 | ok | |
eeb6b95e | 35 | RETVAL=$? |
36 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/maradns | |
37 | else | |
38 | msg_Already_Running "maraDNS" | |
39 | exit 1 | |
40 | fi | |
41 | ;; | |
42 | stop) | |
43 | if [ -f /var/lock/subsys/maradns ]; then | |
44 | msg_stopping "maraDNS" | |
45 | killproc maradns | |
46 | rm -f /var/lock/subsys/maradns >/dev/null 2>&1 | |
47 | else | |
48 | msg_Not_Running "maraDNS" | |
49 | exit 1 | |
50 | fi | |
51 | ;; | |
52 | status) | |
53 | # "status" Not implemented yet | |
54 | # /usr/sbin/rndc status | |
55 | # exit $? | |
56 | status maradns | |
57 | ;; | |
58 | reload) | |
59 | if [ -f /var/lock/subsys/maradns ]; then | |
60 | msg_reloading "maraDNS" | |
61 | killproc maradns -HUP | |
62 | else | |
63 | msg_Not_Running "maraDNS" | |
64 | exit 1 | |
65 | fi | |
66 | ||
67 | ;; | |
68 | restart) | |
69 | $0 stop | |
70 | $0 start | |
71 | ;; | |
72 | *) | |
73 | msg_Usage "$0 {start|stop|status|reload|restart}" | |
74 | exit 1 | |
75 | esac | |
76 | ||
77 | exit $RETVAL |