]>
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. | |
61999e4f | 18 | if is_yes "${NETWORKING}"; then |
19 | if [ ! -f /var/lock/subsys/network ]; then | |
20 | msg_network_down "maraDNS" | |
21 | exit 1 | |
22 | fi | |
23 | else | |
24 | exit 0 | |
eeb6b95e | 25 | fi |
26 | ||
27 | # Sanity check | |
28 | [ -e /etc/mararc ] || exit 0 | |
29 | ||
30 | # See how we were called. | |
31 | case "$1" in | |
32 | start) | |
33 | # Check if the service is already running? | |
34 | if [ ! -f /var/lock/subsys/maradns ]; then | |
35 | msg_starting "maraDNS" | |
61999e4f | 36 | maradns -f /etc/mararc > /var/log/maradns & |
37 | busy | |
38 | # what if it won't start on time? wait a bit for it :) | |
39 | sleep 1 | |
40 | pid=`pidofproc maradns` | |
41 | if [ -n "$pid" ]; then | |
42 | RETVAL=0 | |
43 | touch /var/lock/subsys/maradns | |
44 | log_success "maradns startup" | |
45 | ok | |
46 | else | |
47 | RETVAL=1 | |
48 | log_failed "maradns startup" | |
49 | fail | |
50 | fi | |
eeb6b95e | 51 | else |
27e355a1 | 52 | msg_already_running "maraDNS" |
eeb6b95e | 53 | exit 1 |
54 | fi | |
61999e4f | 55 | ;; |
eeb6b95e | 56 | stop) |
61999e4f | 57 | if [ -f /var/lock/subsys/maradns ]; then |
58 | msg_stopping "maraDNS" | |
59 | killproc maradns | |
60 | rm -f /var/lock/subsys/maradns >/dev/null 2>&1 | |
61 | else | |
62 | msg_not_running "maraDNS" | |
63 | exit 1 | |
64 | fi | |
eeb6b95e | 65 | ;; |
66 | status) | |
eeb6b95e | 67 | status maradns |
eeb6b95e | 68 | ;; |
61999e4f | 69 | restart|reload) |
eeb6b95e | 70 | $0 stop |
71 | $0 start | |
72 | ;; | |
73 | *) | |
61999e4f | 74 | msg_usage "$0 {start|stop|restart|reload|status}" |
75 | exit 1 | |
eeb6b95e | 76 | esac |
77 | ||
78 | exit $RETVAL |