#!/bin/sh # # freshclamd -- startup script for the Clam AntiVirus Database Update Daemon # # chkconfig: 2345 80 30 # description: Clam AntiVirus Database Update Daemon. # processname: freshclamd # pidfile: /var/run/clamav/freshclam.pid # config: /etc/freshclam.conf # config: /etc/clamd.conf # Source function library. . /etc/rc.d/init.d/functions NAME=freshclam DAEMON=/usr/bin/$NAME DAEMONPID=/var/run/clamav/$NAME.pid DAEMONCONF=/etc/freshclam.conf OPTIONS="--config-file=$DAEMONCONF --quiet --daemon --pid=/var/run/clamav/freshclam.pid" CLAMVDCONF=/etc/clamd.conf [ -x $DAEMON ] || exit 0 # Source networking configuration. [ -r /etc/sysconfig/network ] && . /etc/sysconfig/network [ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME # check if the clamv conf file is present [ -r "$DAEMONCONF" ] || exit 0 USER=`grep '^User' $CLAMVDCONF | awk '{ print $2}'` LOGFILE=`grep '^UpdateLogFile ' $DAEMONCONF | awk '{ print $2}'` case "$1" in start) echo -n $"Starting Clam AntiVirus Update Daemon: " touch ${LOGFILE}; chown ${USER}:${USER} ${LOGFILE} daemon --pidfile=$DAEMONPID $DAEMON $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME ;; stop) echo -n $"Stopping Clam AntiVirus Update Daemon: " killproc -p $DAEMONPID $NAME RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$NAME $DAEMONPID ;; restart|reload) $0 stop sleep 1 $0 start ;; condrestart) [ -e /var/lock/subsys/$NAME ] && $0 restart ;; status) statusproc $DAEMON RETVAL=$? ;; *) echo $"Usage: ""/etc/init.d/$NAME {start|stop|status|restart|condrestart}" exit 1 ;; esac exit $RETVAL