Don:

Another way to do this is to do it during init. If you configure /etc/inittab correctly the system will spawn spamd and insure that the daemon stays running. I do this is with clam antivirus.

/etc/inittab
# CLAMD
cl:2345:respawn:/usr/local/sbin/clamd

One down side of doing something like this is that if the parent processes failes, and the children remain running, init will not restart the daemon. Better would be to write a checker that would perform a test on a test file using spamd/spamc once in a while. Here is a script that I wrote that does this for clamav, it insures the system is actually checking for viruses, by scanning a known infected test file.

-----------------------

#!/bin/bash

script="check_clamd.sh"
tmpfile="/tmp/$script.$$"
HOSTNAME=`/bin/hostname`

/usr/local/bin/clamdscan /var/spool/mail/test_virus_email --stdout >>$tmpfile
grep "Worm.SomeFool.Gen-1 FOUND" $tmpfile >/dev/null
if [ $? == 0 ]
then
       echo "ok!"
else
       echo "not ok!"
       cat $tmpfile
       echo "" >> $tmpfile
echo "Check to make sure that clamd is running. /etc/init.d/clamd start" >>$tmpfile
       echo "" >> $tmpfile
/usr/local/scripts/email.sh [EMAIL PROTECTED] "clamd check failed on $HOSTNAME" /usr/local/scripts/check_clamd.sh $tmpfile
fi

rm -f $tmpfile
-----------------------

It would be simple to mod this script to test for a know spam messasge to make sure everything is running. If not, it could send an alert message

Hope this helps...

HFC



Matt Kettler wrote:

Don O'Neil wrote:
Anyone using inetd to launch spamd? I've had my process die a couple of
times and it would be nice to have inetd around to make sure it's allways
running. If you have, what did you put in inetd.conf?

Using inetd would cause a new spamd instance to be launched for every
message.

At that point it would be faster and more CPU efficient to not use
spamd/spamc, but call the plain-old "spamassassin" script instead.

Another option would be to have a cronjob check to see if spamd isn't
running and restart it. This is kind of a poor-mans hack of an "angel"
process.

(an "angel" process is dedicated program that does nothing but
constantly watch to make sure a daemon stays running and re-launch it
whenever it dies. Often seen used with badly written MUDs that crash
constantly and sometimes on better written code when 100% uptime is a must.)

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to