]>
Commit | Line | Data |
---|---|---|
05a03caa | 1 | #!/bin/sh |
2 | # | |
3 | # newscache Proxy DNS Daemon | |
4 | # | |
5 | # chkconfig: 345 90 10 | |
6 | # | |
7 | # description: Proxy DNS Daemon | |
8 | # | |
9 | ||
10 | # Source function library | |
11 | . /etc/rc.d/init.d/functions | |
12 | ||
13 | # Get network config | |
14 | . /etc/sysconfig/network | |
15 | ||
16 | # Default parameters | |
17 | ||
18 | # Get service config - may override defaults | |
19 | [ -f /etc/sysconfig/newscache ] && . /etc/sysconfig/newscache | |
20 | ||
21 | # Check that networking is up. | |
22 | if is_yes "${NETWORKING}"; then | |
23 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
24 | msg_network_down NewsCache | |
25 | exit 1 | |
26 | fi | |
27 | else | |
28 | exit 0 | |
29 | fi | |
30 | ||
31 | test -x /usr/sbin/newscache || exit 0 | |
32 | ||
33 | RETVAL=0 | |
34 | case "$1" in | |
35 | start) | |
36 | # Check if the service is already running? | |
37 | if [ ! -f /var/lock/subsys/newscache ]; then | |
38 | msg_starting NewsCache | |
39 | daemon newscache | |
40 | RETVAL=$? | |
41 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/newscache | |
42 | else | |
43 | msg_already_running NewsCache | |
44 | fi | |
45 | ;; | |
46 | stop) | |
47 | if [ -f /var/lock/subsys/newscache ]; then | |
48 | msg_stopping NewsCache | |
49 | killproc newscache | |
50 | rm -f /var/lock/subsys/newscache >/dev/null 2>&1 | |
51 | else | |
52 | msg_not_running NewsCache | |
53 | fi | |
54 | ;; | |
55 | restart) | |
56 | $0 stop | |
57 | $0 start | |
58 | exit $? | |
59 | ;; | |
60 | status) | |
61 | status newscached | |
62 | exit $? | |
63 | ;; | |
64 | *) | |
65 | # show "Usage: %s {start|stop|restart|restart}" | |
66 | msg_usage "$0 {start|stop|restart|restart}" | |
67 | exit 3 | |
68 | esac | |
69 | ||
70 | exit $RETVAL |