]>
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 | |
27e355a1 | 19 | msg_network_down "maraDNS" |
eeb6b95e | 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" | |
b82e9c35 | 32 | maradns -f /etc/mararc > /var/log/maradns & |
27e355a1 | 33 | busy |
34 | # what if it won't start on time? wait a bit for it :) | |
35 | sleep 1 | |
36 | pid=`pidofproc maradns` | |
37 | if [ -n "$pid" ]; then | |
38 | RETVAL=0 | |
b82e9c35 | 39 | touch /var/lock/subsys/maradns |
40 | log_success "maradns startup" | |
27e355a1 | 41 | ok |
42 | else | |
b82e9c35 | 43 | RETVAL=1 |
1a1a8cb3 | 44 | log_failed "maradns startup" |
27e355a1 | 45 | fail |
46 | fi | |
eeb6b95e | 47 | else |
27e355a1 | 48 | msg_already_running "maraDNS" |
eeb6b95e | 49 | exit 1 |
50 | fi | |
51 | ;; | |
52 | stop) | |
53 | if [ -f /var/lock/subsys/maradns ]; then | |
54 | msg_stopping "maraDNS" | |
55 | killproc maradns | |
56 | rm -f /var/lock/subsys/maradns >/dev/null 2>&1 | |
57 | else | |
27e355a1 | 58 | msg_not_running "maraDNS" |
eeb6b95e | 59 | exit 1 |
60 | fi | |
61 | ;; | |
62 | status) | |
eeb6b95e | 63 | status maradns |
eeb6b95e | 64 | ;; |
65 | restart) | |
66 | $0 stop | |
67 | $0 start | |
68 | ;; | |
69 | *) | |
27e355a1 | 70 | msg_Usage "$0 {start|stop|status|restart}" |
eeb6b95e | 71 | exit 1 |
72 | esac | |
73 | ||
74 | exit $RETVAL |