]>
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 | |
f15d27a2 | 16 | # Get service config - may override defaults |
17 | [ -f /etc/sysconfig/pdnsd ] && . /etc/sysconfig/pdnsd | |
18 | ||
19 | # Check that networking is up. | |
20 | if is_no "${NETWORKING}"; then | |
21 | msg_Network_Down Pdnsd | |
22 | exit 1 | |
23 | fi | |
24 | ||
25 | test -x /usr/sbin/pdnsd || exit 0 | |
42292d0f | 26 | |
42292d0f | 27 | case "$1" in |
238cdec9 | 28 | start) |
f15d27a2 | 29 | # Check if the service is already running? |
30 | if [ ! -f /var/lock/subsys/pdns ]; then | |
31 | msg_starting Pdns | |
957967af | 32 | daemon pdnsd --daemon |
f15d27a2 | 33 | RETVAL=$? |
34 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pdns | |
35 | else | |
36 | msg_Already_Running Pdns | |
37 | exit 1 | |
38 | fi | |
79ef3bdc | 39 | ;; |
42292d0f | 40 | stop) |
79ef3bdc TP |
41 | # Stop daemons. |
42 | # show "Stopping %s service" pdns | |
007fff28 | 43 | if [ -f /var/lock/subsys/pdns ]; then |
8d303ff6 TP |
44 | msg_stopping Pdns |
45 | killproc pdnsd | |
f15d27a2 | 46 | rm -f /var/lock/subsys/pdns >/dev/null 2>&1 |
47 | else | |
48 | msg_Not_Running Pdns | |
49 | exit 1 | |
8d303ff6 | 50 | fi |
79ef3bdc | 51 | ;; |
f15d27a2 | 52 | restart) |
79ef3bdc | 53 | $0 stop |
8d303ff6 | 54 | $0 start |
79ef3bdc | 55 | ;; |
f15d27a2 | 56 | reload) |
57 | if [ -f /var/lock/subsys/pdns ]; then | |
58 | msg_show Pdns | |
59 | msg_reload | |
60 | busy | |
61 | killproc pdnsd -HUP | |
62 | deltext | |
8d303ff6 | 63 | ok |
f15d27a2 | 64 | else |
65 | msg_Not_Running Pdns | |
66 | exit 1 | |
67 | fi | |
42292d0f | 68 | ;; |
f15d27a2 | 69 | force-reload) |
79ef3bdc | 70 | # if program allows reloading without stopping |
f15d27a2 | 71 | $0 reload |
72 | exit $? | |
73 | ||
74 | # or if it doesn't | |
8d303ff6 | 75 | $0 stop && $0 start |
f15d27a2 | 76 | exit $? |
42292d0f | 77 | ;; |
f15d27a2 | 78 | status) |
79 | status pdnsd | |
80 | exit $? | |
79ef3bdc | 81 | ;; |
42292d0f | 82 | *) |
79ef3bdc | 83 | # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0 |
f15d27a2 | 84 | msg_Usage "$0 {start|stop|status|restart|reload|force-reload}" |
79ef3bdc | 85 | exit 1 |
42292d0f | 86 | esac |
87 | ||
88 | exit $RETVAL |