mike.sanchez wanted us to know:

>>An action could then be taken to
>>alert someone if clamd died (|sendmail [EMAIL PROTECTED]).  When clamd
>>hangs on our system, mail is deferred until I realize mail has stopped and 
>as you can imagine, that is a bad thing. 
>I run a cron once an hour that runs freshclam and does some clamd checks.
>If clamd is not running or errors, an email is sent, any clamd processes are
>killed and a new clamd is started.

I do roughly the same.  Here's my setup:

smtp1 root # cat bin/checksmtp.sh 
#!/bin/bash

# Check end process, then milter.  If either is not running, restart
# both.

PROCS_SPAMASSMILTER=$( /bin/pidof spamass-milter )
PROCS_SPAMD=$( /bin/pidof spamd )
PROCS_CLAMAVMILTER=$( /bin/pidof clamav-milter )
PROCS_CLAMD=$( /bin/pidof clamd )

function restart_spam {
  /etc/init.d/sendmail stop
  /etc/init.d/spamass-milter stop
  /etc/init.d/spamd stop
  /etc/init.d/spamd start
  /etc/init.d/spamass-milter start
  /etc/init.d/sendmail start
}

function restart_clam {
  /etc/init.d/sendmail stop
  /etc/init.d/clamav-milter stop
  /etc/init.d/clamd stop
  /etc/init.d/clamd start
  /etc/init.d/clamav-milter start
  /etc/init.d/sendmail/start
}

if [ -z "$PROCS_SPAMASSMILTER" -o -z "$PROCS_SPAMD" ] ; then
  echo "Spamass-milter procs: $PROCS_SPAMASSMILTER"
  echo "Spamd procs: $PROCS_SPAMD"
  restart_spam
fi

if [ -z "$PROCS_CLAMAVMILTER" -o -z "$PROCS_CLAMD" ] ; then
  echo "Clamav-milter procs: $PROCS_CLAMAVMILTER"
  echo "Clamd procs: $PROCS_CLAMD"
  restart_clam
fi


smtp1 root # crontab -l | grep checksmtp.sh
46 */4 * * * /root/bin/checksmtp.sh

-- 
Regards...              Todd
They that can give up essential liberty to obtain a little temporary 
safety deserve neither liberty nor safety.       --Benjamin Franklin
Linux kernel 2.6.8.1-12mdkenterprise   load average: 0.11, 0.08, 0.23
_______________________________________________
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-users

Reply via email to