#!/bin/sh # # clamav Startup script for the Clam AntiVirus Daemon. # # chkconfig: 2345 75 25 # description: Clam AntiVirus Daemon is a TCP/IP or socket protocol \ # server. # processname: clamd # config: /etc/clamd.conf # pidfile: /var/run/clamav/clamd.pid # Do not load RH compatibility interface. WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions # Source clamd configuration. SourceIfNotEmpty /etc/sysconfig/clamd PIDFILE=/var/run/clamav/clamd.pid LOCKFILE=/var/lock/subsys/clamd RETVAL=0 start() { if [ ! -s /var/lib/clamav/main.cvd -a ! -s /var/lib/clamav/main.cld -a ! -d /var/lib/clamav/main.inc -a ! -d /var/lib/clamav/daily.inc ]; then /usr/bin/freshclam fi start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user mail -- clamd RETVAL=$? return $RETVAL } stop() { stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user mail clamd RETVAL=$? return $RETVAL } restart() { stop start } reload() { msg_reloading clamd stop_daemon --pidfile "$PIDFILE" --expect-user mail -HUP -- clamd RETVAL=$? return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) restart ;; update) /usr/bin/freshclam ;; status) status --pidfile "$PIDFILE" --expect-user mail -- clamd RETVAL=$? ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; condreload) if [ -e "$LOCKFILE" ]; then reload fi ;; *) msg_usage "${0##*/} {start|stop|restart|reload|condstop|condrestart|condreload|status|update}" RETVAL=1 esac exit $RETVAL