#!/usr/local/usr/local/bin/bash

#
# Change the next '1' to '0' to enable this regular update.
# It is disabled by default as it causes problems on many systems.
#

Disabled=yes;

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

# Add the following line to /etc/rc.conf to configure a maximum delay in
# order to spread virus updates round the clock. 1800 seconds = 30 minutes.
# Set this to 0 to disable it

. /etc/rc.subr

name="mailscanner"
rcvar=`set_rcvar`

load_rc_config $name

: ${mailscanner_updatemaxdelay="600"}

SAUPDATE=/usr/local/bin/sa-update
export SAUPDATE

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


syntax highlighted by Code2HTML, v. 0.9.1