#!/bin/sh # # Startup script for the Clam AntiVirus on-access scanning daemon # # chkconfig: - 61 39 # description: ClamAV on-access scanning daemon # processname: clamonacc # pidfile: /var/run/clamav/clamonacc.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network [ -x /usr/sbin/clamonacc ] || exit 0 # Local clamonacc config test -f /etc/sysconfig/clamonacc && . /etc/sysconfig/clamonacc # See how we were called. case "$1" in start) echo -n "Starting Clam AntiVirus on-access scanning daemon: " while [ ! -S /var/run/clamav/clamd.sock ]; do sleep 1; done daemon clamonacc $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamonacc ;; stop) echo -n "Stopping Clam AntiVirus on-access scanning daemon: " killproc clamonacc rm -f /var/run/clamav/clamonacc.pid RETVAL=$? echo ### heres the fix... we gotta remove the stale files on restart [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamonacc ;; status) status clamonacc RETVAL=$? ;; restart|reload) $0 stop $0 start RETVAL=$? ;; condrestart) [ -e /var/lock/subsys/clamonacc ] && $0 restart RETVAL=$? ;; *) echo "Usage: clamonacc {start|stop|status|restart|reload|condrestart}" exit 1 esac exit $RETVAL