#!/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) echo -n "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) echo -n "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=$? ;; *) echo "Usage: clamd {start|stop|status|restart|reload}" exit 1 esac exit $RETVAL