#!/bin/bash

#
# Change the next 'yes' to 'no' to enable this regular update.
#

Disabled=no;

if [ "x$Disabled" = "xyes" ]; then
  exit;
fi

# 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.
UPDATEMAXDELAY=3600
MSSAUPDATE=/usr/sbin/update_spamassassin
if [ -f /etc/sysconfig/MailScanner ] ; then
        . /etc/sysconfig/MailScanner
fi
export UPDATEMAXDELAY
export MSSAUPDATE

[ -x $MSSAUPDATE ] || exit 0
if [ "x$UPDATEMAXDELAY" = "x0" ]; then
  :
else
  logger -p mail.info -t update_spamassassin Delaying cron job up to $UPDATEMAXDELAY seconds
  perl -e "sleep int(rand($UPDATEMAXDELAY));"
fi
exec $MSSAUPDATE
exit 0
