#!/bin/bash # # clamav: This script controls the clamd # # chkconfig: 2345 79 31 # description: clamav # processname: clamav # pidfile: /var/run/clam.pid # Source function library. . /etc/rc.d/init.d/functions prog="/usr/local/sbin/clamd" prog_base="ClamD" prog_config_file="/etc/clamav.conf" ## Check that networking is up. RETVAL=0 # See how we were called. case "$1" in start) echo -n "Starting $prog_base:" $prog -c $prog_config_file >> /var/log/clamd.log & RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/${prog_base} success echo ;; stop) echo -n "Shutting down $prog_base:" #Force the kill... kill `ps -A | grep clamd | cut -c1-6` &> /dev/null RETVAL=$? #Sleep for a second or two. /bin/sleep 3s #Kill the stale socket. rm -f /tmp/clamd > /dev/null if [ $RETVAL -eq 0 ] ; then success #echo "${prog_base} stopped" rm -f /var/lock/subsys/${prog_base} echo else echo fi ;; status) status ${prog_base} RETVAL=$? ;; restart) $0 stop $0 start RETVAL=$? ;; reload) #action $"Reloading ${prog_base}:" ${prog} -c ${prog_config_file} reload $0 restart RETVAL=$? ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1 esac exit $RETVAL