#!/bin/sh # clamav # Source functions library source /etc/rc.d/init.d/functions SOCKET_DIR="/var/run/clamav" start() { if statusproc clamd | grep -q "stopped"; then # Not taking any chances, removing left-over files rm -f ${SOCKET_DIR}/clamd.{sock,pid} || return 1 fi loadproc /usr/sbin/clamd || return 1 sleep 1 if statusproc clamav-milter | grep -q "stopped"; then # Not taking any chances, removing left-over files rm -f ${SOCKET_DIR}/clmilter.sock || return 1 fi # Option "--postmaster-only" is to send warnings only to postmaster. loadproc /usr/sbin/clamav-milter --local --outgoing --headers \ --postmaster-only ${SOCKET_DIR}/clmilter.sock return $? } stop() { killproc clamd && killproc clamav-milter return $? } log_script_name "$0 $*" case "$1" in start) cmd_run_log_box_warn "Clam AntiVirus start" start ;; stop) cmd_run_log_box_warn "Clam AntiVirus stop" stop ;; status) statusproc clamd statusproc clamav-milter ;; restart) $0 stop sleep 1 $0 start ;; *) echo "Usage: $0 {restart|start|status|stop}" exit ${EXIT_CODE_FAILURE} ;; esac exit $?