]>
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 |
264032cf | 19 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
61999e4f | 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 | ||
b98d6629 | 30 | RETVAL=0 |
eeb6b95e | 31 | # See how we were called. |
32 | case "$1" in | |
33 | start) | |
34 | # Check if the service is already running? | |
35 | if [ ! -f /var/lock/subsys/maradns ]; then | |
36 | msg_starting "maraDNS" | |
61999e4f | 37 | maradns -f /etc/mararc > /var/log/maradns & |
38 | busy | |
39 | # what if it won't start on time? wait a bit for it :) | |
40 | sleep 1 | |
41 | pid=`pidofproc maradns` | |
42 | if [ -n "$pid" ]; then | |
61999e4f | 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 | fi |
61999e4f | 54 | ;; |
eeb6b95e | 55 | stop) |
61999e4f | 56 | if [ -f /var/lock/subsys/maradns ]; then |
57 | msg_stopping "maraDNS" | |
58 | killproc maradns | |
59 | rm -f /var/lock/subsys/maradns >/dev/null 2>&1 | |
60 | else | |
61 | msg_not_running "maraDNS" | |
61999e4f | 62 | fi |
eeb6b95e | 63 | ;; |
64 | status) | |
eeb6b95e | 65 | status maradns |
b98d6629 | 66 | exit $? |
eeb6b95e | 67 | ;; |
b98d6629 | 68 | restart|force-reload) |
eeb6b95e | 69 | $0 stop |
70 | $0 start | |
b98d6629 | 71 | exit $? |
eeb6b95e | 72 | ;; |
73 | *) | |
b98d6629 | 74 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
75 | exit 3 | |
eeb6b95e | 76 | esac |
77 | ||
78 | exit $RETVAL |