]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # | |
3 | # newscache newscache - news caching daemon | |
4 | # | |
5 | # chkconfig: 345 90 10 | |
6 | # | |
7 | # description: NewsCache acts to news reading clients like a news server,\ | |
8 | # except that it stores only those articles that have been\ | |
9 | # requested by at least one client. NewsCache targets problems\ | |
10 | # of the current News System like network bandwidth consumption\ | |
11 | # or the IO load caused by news clients. | |
12 | # | |
13 | ||
14 | # Source function library | |
15 | . /etc/rc.d/init.d/functions | |
16 | ||
17 | # Get network config | |
18 | . /etc/sysconfig/network | |
19 | ||
20 | # Get service config - may override defaults | |
21 | [ -f /etc/sysconfig/newscache ] && . /etc/sysconfig/newscache | |
22 | ||
23 | # Check that networking is up. | |
24 | if is_yes "${NETWORKING}"; then | |
25 | if [ ! -f /var/lock/subsys/network ]; then | |
26 | msg_network_down newscache | |
27 | exit 1 | |
28 | fi | |
29 | else | |
30 | exit 0 | |
31 | fi | |
32 | ||
33 | ||
34 | # See how we were called. | |
35 | case "$1" in | |
36 | start) | |
37 | # Check if the service is already running? | |
38 | if [ ! -f /var/lock/subsys/newscache ]; then | |
39 | msg_starting newscache | |
40 | daemon newscache | |
41 | RETVAL=$? | |
42 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/newscache | |
43 | else | |
44 | msg_already_running newscache | |
45 | fi | |
46 | ;; | |
47 | stop) | |
48 | if [ -f /var/lock/subsys/newscache ]; then | |
49 | # Stop daemons. | |
50 | msg_stopping newscache | |
51 | killproc newscache | |
52 | rm -f /var/lock/subsys/newscache | |
53 | else | |
54 | msg_not_running newscache | |
55 | fi | |
56 | ;; | |
57 | restart) | |
58 | $0 stop | |
59 | $0 start | |
60 | exit $? | |
61 | ;; | |
62 | reload) | |
63 | if [ -f /var/lock/subsys/newscache ]; then | |
64 | msg_reloading newscache | |
65 | killproc newscache -HUP | |
66 | RETVAL=$? | |
67 | else | |
68 | msg_not_running newscache >&2 | |
69 | RETVAL=7 | |
70 | fi | |
71 | ;; | |
72 | force-reload) | |
73 | # if program allows reloading without stopping | |
74 | $0 reload | |
75 | ||
76 | # or if it doesn't | |
77 | $0 restart | |
78 | ||
79 | exit $? | |
80 | ;; | |
81 | status) | |
82 | status newscache | |
83 | RETVAL=$? | |
84 | ;; | |
85 | *) | |
86 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" | |
87 | exit 3 | |
88 | esac | |
89 | ||
90 | exit $RETVAL | |
91 | ||
92 | # This must be last line ! | |
93 | # vi:syntax=sh:tw=78:ts=8:sw=4 |