freebsd-ports/mail/assp/files/periodic-assp.sh.in
Pav Lucistnik e13427c27b Minor changes:
- suppressed two messages logged to stdout when ASSP first starts up
- changed nightly 510.assp periodic script to redirect rebuildspamdb.pl
  messages to a file in ASSP dir (nightly.log), thereby suppressing them from
  the nightly email
- added rc.conf variable:
  assp_logexpire="45"
  used by nightly 510.assp periodic script to expire old YY-MM-DD.maillog.txt
  files from ASSP dir
- changed the assp(8) manual page to document the new assp_logexpire
  configuration variable

PR:		ports/90118
Submitted by:	J.R. Oldroyd <fbsd@opal.com> (maintainer)
2005-12-09 09:04:29 +00:00

44 lines
1.1 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# 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))