]>
Commit | Line | Data |
---|---|---|
05a03caa | 1 | #!/bin/sh |
2 | # | |
603eac47 | 3 | # newscache newscache - news caching daemon |
05a03caa | 4 | # |
603eac47 | 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 |
26 | # nls "ERROR: Networking is down. %s can't be run." newscache | |
27 | msg_network_down newscache | |
05a03caa | 28 | exit 1 |
29 | fi | |
30 | else | |
31 | exit 0 | |
32 | fi | |
33 | ||
05a03caa | 34 | |
603eac47 | 35 | # See how we were called. |
05a03caa | 36 | case "$1" in |
37 | start) | |
38 | # Check if the service is already running? | |
39 | if [ ! -f /var/lock/subsys/newscache ]; then | |
603eac47 | 40 | # show "Starting %s service" newscache |
41 | msg_starting newscache | |
42 | daemon newscache | |
05a03caa | 43 | RETVAL=$? |
44 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/newscache | |
45 | else | |
603eac47 | 46 | # show "%s service is already running." newscache |
47 | msg_already_running newscache | |
05a03caa | 48 | fi |
49 | ;; | |
50 | stop) | |
51 | if [ -f /var/lock/subsys/newscache ]; then | |
603eac47 | 52 | # Stop daemons. |
53 | # show "Stopping %s service" newscache | |
54 | msg_stopping newscache | |
05a03caa | 55 | killproc newscache |
603eac47 | 56 | rm -f /var/lock/subsys/newscache |
05a03caa | 57 | else |
603eac47 | 58 | # show "%s service is not running." newscache |
59 | msg_not_running newscache | |
05a03caa | 60 | fi |
61 | ;; | |
62 | restart) | |
63 | $0 stop | |
64 | $0 start | |
65 | exit $? | |
66 | ;; | |
603eac47 | 67 | reload) |
68 | if [ -f /var/lock/subsys/newscache ]; then | |
69 | # show "Reload %s service" newscache | |
70 | msg_reloading newscache | |
71 | killproc newscache -HUP | |
72 | RETVAL=$? | |
73 | else | |
74 | # show "%s service is not running." newscache | |
75 | msg_not_running newscache >&2 | |
76 | RETVAL=7 | |
77 | fi | |
78 | ;; | |
79 | force-reload) | |
80 | # if program allows reloading without stopping | |
81 | $0 reload | |
82 | ||
83 | # or if it doesn't | |
84 | $0 restart | |
85 | ||
05a03caa | 86 | exit $? |
87 | ;; | |
603eac47 | 88 | status) |
89 | status newscache | |
90 | RETVAL=$? | |
91 | ;; | |
05a03caa | 92 | *) |
603eac47 | 93 | # show "Usage: %s {start|stop|restart|reload|force-reload|status}" |
94 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" | |
05a03caa | 95 | exit 3 |
96 | esac | |
97 | ||
98 | exit $RETVAL | |
603eac47 | 99 | |
100 | # This must be last line ! | |
101 | # vi:syntax=sh:tw=78:ts=8:sw=4 |