#!/bin/sh
#
# $FreeBSD: ports/mail/assp/files/periodic-assp.sh.in,v 1.2 2005/12/09 09:04:29 pav Exp $
#
# Update ASSP Spam and ClamAV databases
cd %%ASSP_HOME%%
[ -f nightly.log ] && mv nightly.log nightly.log.old
if [ ! -f %%PREFIX%%/lib/assp/rebuildspamdb.pl ]
then
echo "%%PREFIX%%/lib/assp/rebuildspamdb.pl does not exist"
rc_spamdb=2
else
echo ""
echo "Running ASSP rebuildspamdb.pl (output to nightly.log)"
echo "Running ASSP rebuildspamdb.pl:" >>nightly.log
%%PERL%% %%PREFIX%%/lib/assp/rebuildspamdb.pl >>nightly.log && rc_spamdb=0 || rc_spamdb=3
fi
if [ ! -f %%PREFIX%%/lib/assp/freshclam.sh ]
then
# existence of freshclam.sh is optional, dependent
# on the WITH_CLAMAV setting, so not an error if not there
rc_clamav=0
else
echo ""
echo "Fetching ASSP ClamAV virus database updates:"
export PATH=$PATH:%%LOCALBASE%%/bin
sh %%PREFIX%%/lib/assp/freshclam.sh && rc_clamav=0 || rc_clamav=3
fi
. %%RC_SUBR%%
name=assp
rcvar=`set_rcvar`
load_rc_config $name
: ${assp_logexpire="45"}
echo ""
echo "Removing old ASSP log files:"
find . -name '*.maillog.txt' -mtime +$assp_logexpire -exec ls -l {} \; -exec rm {} \;
exit $(($rc_spamdb|$rc_clamav))
syntax highlighted by Code2HTML, v. 0.9.1