Mailscanner leaves two running processes when restarting

Rasmus Bøg Hansen moffelist at AMAGERKOLLEGIET.DK
Mon May 19 18:50:17 IST 2003


Julian Field <mailscanner at ECS.SOTON.AC.UK> writes:

>>mail     11612  0.1  9.8 23272 12624 ?       S    09:00   0:06 [mailscanner]
>>mail     13598  0.6 15.8 23212 20284 ?       S    10:00   0:04 [mailscanner]

>>This results in the two running mailscanners trying to scan messages
>>at the same time:
>
> The output of the "ps" command changed completely with a recent glibc
> upgrade. As a result, check_mailscanner (called by an hourly cron job)
> totally fails, and attempts to start another MailScanner process. If
> you want to see how to do it these days, take a look in any recent
> version of MailScanner and transplant the guts of the current
> check_mailscanner into your old version.

The scripts were almost identical.

However the error came from mailscanner being listed as [mailscanner]
(probably as some data were swapped out, I guess). check_mailscanner
saw no running mailscanner and spawned a new one - resulting in to
concurrent mailscanners running.

I did this change to the script:

--- check_mailscanner.linux.old Mon May 19 18:44:15 2003
+++ check_mailscanner.linux     Mon May 19 18:44:46 2003
@@ -40,7 +40,7 @@
 config=/etc/mailscanner/mailscanner.conf

 pid=`/bin/ps axww |
-     /bin/grep '[ ]'$virusdir/$process |
+     /bin/egrep "([ ]$virusdir/$process|\[mailscanner\])" |
      /usr/bin/awk '{ print $1 }'`
 if [ "$pid" = "" ]; then
   # Restart it

Now it works whether mailscanner is listed as the right name
(/usr/sbin/mailscanner here) or as [mailscanner].

Thank you for the help.

/Rasmus

-- 
-- [ Rasmus "Møffe" Bøg Hansen ] ---------------------------------------
Linux hackers are funny people: They count the time in patchlevels.
----------------------------------[ moffe at amagerkollegiet dot dk ] --




More information about the MailScanner mailing list