Virus update times

Julian Field mailscanner at ecs.soton.ac.uk
Mon Mar 1 08:49:40 GMT 2004


At 20:52 29/02/2004, you wrote:
>Kevin Spicer wrote:
>
>>Theres been some discussion on the clamav list recently about the
>>frequency of clients pulling database updates from their servers.  the
>>most notable point was that several of the clam developers urged users
>>to schedule their cron jobs at a random minute past the hour to try and
>>get a better distribution of load on the servers.  I guess similar
>>problems also afflict users of commercial scanners.
>>
>>Several things stuck me.
>>1) Many (most?) MailScanner users use cron.hourly to schedule updates,
>>therefore we, as a community, are probably responsible for a
>>substantially increased load at one point every hour.
>>2) Everyone updating at the same time increases the possibility of
>>individual updates failing due to bandwidth/ server issues
>>3) Any problems with the virus database introduced immediately before
>>the point we all update are likely to affect all of us before they get
>>fixed
>>4) We all have the same window of opportunity in our update cycles
>>during which a new virus could propagate very quickly, at least if we
>>all updated at different times we may stand a better chance of slowing
>>the rate of spread.
>>
>>I therefore propose that update_virus_scanners be moved from
>>/etc/cron.hourly to a file in /etc/cron.d and that the minute at which
>>it is scheduled in that file be generated either at random or be the
>>same as the minute at which the file was installed.  Obviously this
>>would involve generating the file as part of the install process.
>
>could it be possible to set this in update_virus_scanners with a random
>value
>i hope that this would not stop other scripts in cron.hourly.
>
>
># vi /usr/sbin/update_virus_scanners
>
>#!/bin/bash
>
>sleep 300
>
>SCANNERSCONF=/etc/MailScanner/virus.scanners.conf
>[...]
>
>
>
>or
># crontab -e -umailscanner-user

This is the new cron job. Delays by up to 30 minutes if you change the "0"
to "1800". I will leave the delay at 0 by default for now, to see if this
causes any problems or complaints. I might change the default to 1800 in a
future release.

#!/bin/bash

# Insert a random delay up to this value, to spread virus updates round
# the clock. 1800 seconds = 30 minutes.
# Set this to 0 to disable it.
DELAY=0

[ -x /usr/sbin/update_virus_scanners ] || exit 0
if [ "x$DELAY" = "x0" ]; then
   :
else
   logger -p mail.info -t update.virus.scanners Delaying cron job up to
$DELAY seconds
   perl -e "sleep int(rand($DELAY));"
fi
exec /usr/sbin/update_virus_scanners
exit 0

--
Julian Field
www.MailScanner.info
MailScanner thanks transtec Computers for their support

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654



More information about the MailScanner mailing list