Sophie

Sophie

distrib > Mageia > 2 > i586 > by-pkgid > 27bc45be6e101b1ecc3275acaf4128c9 > files > 2

clamd-0.97.7-1.mga2.i586.rpm

#!/bin/sh
#
# Startup script for the Clam AntiVirus Daemon
#
# chkconfig: 2345 79 30
# description: Clam AntiVirus Daemon is a TCP/IP or unix domain 
# socket protocol server.
# processname: clamd
# pidfile: /var/run/clamav/clamd.pid
# config: /etc/clamd.conf

### BEGIN INIT INFO
# Provides: clamd
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 3 4 5
# Short-Description: An AntiVirus Server
# Description: Clam AntiVirus Daemon is a TCP/IP or unix domain 
#              socket protocol server.
### END INIT INFO

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

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

[ -x /usr/sbin/clamd ] || exit 0

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

[ -f /etc/sysconfig/clamd ] && . /etc/sysconfig/clamd

# See how we were called.
case "$1" in
  start)
	gprintf "Starting Clam AntiVirus Daemon: "
	chown -R ${USER}:${USER} /var/log/clamav /var/run/clamav /var/lib/clamav
	daemon clamd $CLAMD_OPTIONS
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd
	;;
  stop)
	gprintf "Stopping Clam AntiVirus Daemon: "
	killproc clamd
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd $PIDFILE $LOCALSOCKET
	;;
  status)
	status clamd
	RETVAL=$?
	;;
  restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
	gprintf "Usage: clamd {start|stop|status|restart|reload}\n"
	exit 1
esac

exit $RETVAL