#!/bin/sh # # newscache newscache - news caching daemon # # chkconfig: 345 90 10 # # description: NewsCache acts to news reading clients like a news server,\ # except that it stores only those articles that have been\ # requested by at least one client. NewsCache targets problems\ # of the current News System like network bandwidth consumption\ # or the IO load caused by news clients. # # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config - may override defaults [ -f /etc/sysconfig/newscache ] && . /etc/sysconfig/newscache # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network ]; then # nls "ERROR: Networking is down. %s can't be run." newscache msg_network_down newscache exit 1 fi else exit 0 fi # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/newscache ]; then # show "Starting %s service" newscache msg_starting newscache daemon newscache RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/newscache else # show "%s service is already running." newscache msg_already_running newscache fi ;; stop) if [ -f /var/lock/subsys/newscache ]; then # Stop daemons. # show "Stopping %s service" newscache msg_stopping newscache killproc newscache rm -f /var/lock/subsys/newscache else # show "%s service is not running." newscache msg_not_running newscache fi ;; restart) $0 stop $0 start exit $? ;; reload) if [ -f /var/lock/subsys/newscache ]; then # show "Reload %s service" newscache msg_reloading newscache killproc newscache -HUP RETVAL=$? else # show "%s service is not running." newscache msg_not_running newscache >&2 RETVAL=7 fi ;; force-reload) # if program allows reloading without stopping $0 reload # or if it doesn't $0 restart exit $? ;; status) status newscache RETVAL=$? ;; *) # show "Usage: %s {start|stop|restart|reload|force-reload|status}" msg_usage "$0 {start|stop|restart|reload|force-reload|status}" exit 3 esac exit $RETVAL # This must be last line ! # vi:syntax=sh:tw=78:ts=8:sw=4