]>
Commit | Line | Data |
---|---|---|
f15d27a2 | 1 | #!/bin/sh |
42292d0f | 2 | # |
f15d27a2 | 3 | # pdns Proxy DNS Daemon |
42292d0f | 4 | # |
1d08e2b6 | 5 | # chkconfig: 345 14 89 |
42292d0f | 6 | # |
f15d27a2 | 7 | # description: Proxy DNS Daemon |
42292d0f | 8 | # |
9 | ||
f15d27a2 | 10 | # Source function library |
42292d0f | 11 | . /etc/rc.d/init.d/functions |
12 | ||
f15d27a2 | 13 | # Get network config |
14 | . /etc/sysconfig/network | |
42292d0f | 15 | |
4a176474 | 16 | # Default parameters |
17 | STATUS="--status" | |
18 | DEBUG="--debug" | |
19 | VERBOSE="-v2" | |
20 | ||
f15d27a2 | 21 | # Get service config - may override defaults |
22 | [ -f /etc/sysconfig/pdnsd ] && . /etc/sysconfig/pdnsd | |
23 | ||
24 | # Check that networking is up. | |
25 | if is_no "${NETWORKING}"; then | |
26 | msg_Network_Down Pdnsd | |
27 | exit 1 | |
28 | fi | |
29 | ||
30 | test -x /usr/sbin/pdnsd || exit 0 | |
42292d0f | 31 | |
42292d0f | 32 | case "$1" in |
238cdec9 | 33 | start) |
f15d27a2 | 34 | # Check if the service is already running? |
35 | if [ ! -f /var/lock/subsys/pdns ]; then | |
36 | msg_starting Pdns | |
4a176474 | 37 | daemon pdnsd --daemon $STATUS $DEBUG $VERBOSE |
f15d27a2 | 38 | RETVAL=$? |
39 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pdns | |
40 | else | |
41 | msg_Already_Running Pdns | |
42 | exit 1 | |
43 | fi | |
79ef3bdc | 44 | ;; |
42292d0f | 45 | stop) |
79ef3bdc TP |
46 | # Stop daemons. |
47 | # show "Stopping %s service" pdns | |
007fff28 | 48 | if [ -f /var/lock/subsys/pdns ]; then |
8d303ff6 TP |
49 | msg_stopping Pdns |
50 | killproc pdnsd | |
f15d27a2 | 51 | rm -f /var/lock/subsys/pdns >/dev/null 2>&1 |
52 | else | |
53 | msg_Not_Running Pdns | |
54 | exit 1 | |
8d303ff6 | 55 | fi |
79ef3bdc | 56 | ;; |
f15d27a2 | 57 | restart) |
79ef3bdc | 58 | $0 stop |
8d303ff6 | 59 | $0 start |
79ef3bdc | 60 | ;; |
f15d27a2 | 61 | reload) |
62 | if [ -f /var/lock/subsys/pdns ]; then | |
63 | msg_show Pdns | |
64 | msg_reload | |
65 | busy | |
66 | killproc pdnsd -HUP | |
67 | deltext | |
8d303ff6 | 68 | ok |
f15d27a2 | 69 | else |
70 | msg_Not_Running Pdns | |
71 | exit 1 | |
72 | fi | |
42292d0f | 73 | ;; |
f15d27a2 | 74 | force-reload) |
79ef3bdc | 75 | # if program allows reloading without stopping |
f15d27a2 | 76 | $0 reload |
77 | exit $? | |
78 | ||
79 | # or if it doesn't | |
8d303ff6 | 80 | $0 stop && $0 start |
f15d27a2 | 81 | exit $? |
42292d0f | 82 | ;; |
f15d27a2 | 83 | status) |
84 | status pdnsd | |
85 | exit $? | |
79ef3bdc | 86 | ;; |
42292d0f | 87 | *) |
79ef3bdc | 88 | # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0 |
f15d27a2 | 89 | msg_Usage "$0 {start|stop|status|restart|reload|force-reload}" |
79ef3bdc | 90 | exit 1 |
42292d0f | 91 | esac |
92 | ||
93 | exit $RETVAL |