]>
Commit | Line | Data |
---|---|---|
05a03caa | 1 | #!/bin/sh |
2 | # | |
e1a15642 | 3 | # newscache newscache - news caching daemon |
05a03caa | 4 | # |
e1a15642 | 5 | # chkconfig: 345 90 10 |
05a03caa | 6 | # |
603eac47 | 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. | |
05a03caa | 12 | # |
13 | ||
14 | # Source function library | |
15 | . /etc/rc.d/init.d/functions | |
16 | ||
17 | # Get network config | |
18 | . /etc/sysconfig/network | |
19 | ||
05a03caa | 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 | |
603eac47 | 25 | if [ ! -f /var/lock/subsys/network ]; then |
603eac47 | 26 | msg_network_down newscache |
05a03caa | 27 | exit 1 |
28 | fi | |
29 | else | |
30 | exit 0 | |
31 | fi | |
32 | ||
05a03caa | 33 | |
603eac47 | 34 | # See how we were called. |
05a03caa | 35 | case "$1" in |
36 | start) | |
37 | # Check if the service is already running? | |
38 | if [ ! -f /var/lock/subsys/newscache ]; then | |
603eac47 | 39 | msg_starting newscache |
40 | daemon newscache | |
05a03caa | 41 | RETVAL=$? |
42 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/newscache | |
43 | else | |
603eac47 | 44 | msg_already_running newscache |
05a03caa | 45 | fi |
46 | ;; | |
47 | stop) | |
48 | if [ -f /var/lock/subsys/newscache ]; then | |
603eac47 | 49 | # Stop daemons. |
603eac47 | 50 | msg_stopping newscache |
05a03caa | 51 | killproc newscache |
603eac47 | 52 | rm -f /var/lock/subsys/newscache |
05a03caa | 53 | else |
603eac47 | 54 | msg_not_running newscache |
05a03caa | 55 | fi |
56 | ;; | |
57 | restart) | |
58 | $0 stop | |
59 | $0 start | |
60 | exit $? | |
61 | ;; | |
603eac47 | 62 | reload) |
63 | if [ -f /var/lock/subsys/newscache ]; then | |
603eac47 | 64 | msg_reloading newscache |
65 | killproc newscache -HUP | |
66 | RETVAL=$? | |
67 | else | |
603eac47 | 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 | ||
05a03caa | 79 | exit $? |
80 | ;; | |
603eac47 | 81 | status) |
82 | status newscache | |
83 | RETVAL=$? | |
84 | ;; | |
05a03caa | 85 | *) |
603eac47 | 86 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" |
05a03caa | 87 | exit 3 |
88 | esac | |
89 | ||
90 | exit $RETVAL | |
603eac47 | 91 | |
92 | # This must be last line ! | |
93 | # vi:syntax=sh:tw=78:ts=8:sw=4 |