In an earlier post a fix for the over quota (and suspended) users was
written to avoid spamd to loop.
Strange anough it doesn't seem to kill every 3 minutes on my machines,
sometimes it can last over an hour to be killed and it logs a lot of non-
exiting usernames such as 694, 692, 681 and 722...
Can anyone explain what's going on?
Thanx in advance,
Ferris
This is a small portion of the log file:
2006-09-09 at 12:32 - Killed SPAMd process 1980 belonging to user 694 after
00:17
2006-09-09 at 12:53 - Killed SPAMd process 2294 belonging to user srsams1
after 00:44
2006-09-09 at 13:03 - Killed SPAMd process 2719 belonging to user 699 after
00:39
There is a file /etc/cron.d/spamd.cron which contains:
*/1 * * * * root /usr/bin/spamd.fix
And this is the script usr/bin/spamd.fix
#!/bin/bash
LIMIT=`expr 3`
for PROID in `ps auxwf |grep "\_ spamd child"|grep -v root|awk '{print $2}'`
do
HOURS=`ps -fp $PROID | grep -v STIME | awk '{print $7}'|cut -d":" -f2`
MINS=`ps -fp $PROID | grep -v TIME | awk '{print $7}'|cut -d":" -f3`
USER=`ps -fp $PROID | grep -v TIME | awk '{print $1}'`
if [ "$HOURS" = "" ]
then
HOURS=`expr 0`
fi
if [ "$MINS" = "" ]
then
MINS=`expr 1`
fi
ELAPSED=`expr $HOURS \* 60`
ELAPSED=`expr $ELAPSED + $MINS`
if (test $ELAPSED -gt $LIMIT )
then
kill -9 $PROID
echo `date +'%Y-%m-%d at %H:%M'` - Killed SPAMd process $PROID belonging \
to user $USER after $HOURS:$MINS>> /home/spamdFix/log/spamdFix.log
fi
done