#!/bin/sh # freshclam This shell script takes care of starting and stopping # freshclam. # # chkconfig: - 62 38 # description: freshclam is a clamav updater # processname: freshclam # config: /etc/freshclam.conf # pidfile: /var/run/clamd/freshclam.pid # Source function library. . /usr/local/etc/rc.d/functions [ -x /usr/bin/freshclam ] || exit 0 RETVAL=0 LOCK_FILE=/var/spool/lock/freshclam start() { echo -n "Starting freshclam: " daemon /usr/bin/freshclam -d RETVAL=$? if [ $RETVAL -eq 0 ] && touch $LOCK_FILE then echo -e "\t\t[ OK ]"; else echo -e "\t\t[ FAILED ]"; fi return $RETVAL } stop() { echo -n "Shutting down freshclam: " killall freshclam 2> /dev/null RETVAL=$? if [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE then echo -e "\t\t[ OK ]"; else echo -e "\t\t[ FAILED ]"; fi return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status freshclam RETVAL=$? ;; restart) stop start RETVAL=$? ;; condrestart) if [ -f $LOCK_FILE ]; then stop start RETVAL=$? fi ;; reload) echo -n "Re-reading freshclam configuration: " killall -HUP freshclam 2> /dev/null RETVAL=$? if [ $RETVAL = 0 ] then echo -e "\t[ OK ]"; else echo -e "\t[ FAILED ]"; fi ;; *) echo "Usage: freshclam {start|stop|restart|reload|condrestart|status}" exit 1 esac exit $RETVAL