Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > by-pkgid > b2d89f53dc70cced4e3f67fa26bbea40 > files > 11

clamav-0.95.1-2mdv2009.1.src.rpm

#!/bin/sh
#
# Startup script for the Clam AntiVirus Database Update Daemon
#
# chkconfig: 2345 80 30
# description: Clam AntiVirus Database Update Daemon.
# processname: freshclam
# pidfile: /var/run/clamav/freshclam.pid
# config: /etc/freshclam.conf
# config: /etc/clamd.conf

### BEGIN INIT INFO
# Provides: freshclam
# Required-Start: $network $syslog clamd
# Required-Stop: $network $syslog clamd
# Default-Start: 3 4 5
# Short-Description: Clam AntiVirus Database Update Daemon.
# Description: Clam AntiVirus Database Update Daemon.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

[ -x /usr/bin/freshclam ] || exit 0

USER=`grep '^User\b' /etc/clamd.conf|awk '{ print $2}'`
LOGFILE=`grep '^UpdateLogFile\b' /etc/freshclam.conf|awk '{ print $2}'`
PIDFILE=`grep '^PidFile\b' /etc/freshclam.conf|awk '{ print $2}'`

# See how we were called.
case "$1" in
  start)
	echo -n "Starting Clam AntiVirus Update Daemon: "
	touch ${LOGFILE}; chown ${USER}:${USER} ${LOGFILE}
	daemon /usr/bin/freshclam \
	--config-file=/etc/freshclam.conf \
	--user ${USER} \
	--quiet \
	--daemon
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/freshclam
	;;
  stop)
	echo -n "Stopping Clam AntiVirus Update Daemon: "
	killproc freshclam
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/freshclam $PIDFILE
	;;
  status)
	status freshclam
	RETVAL=$?
	;;
  restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
	echo -n "Usage: freshclam {start|stop|status|restart|reload}\n"
	exit 1
esac

exit $RETVAL