#!/bin/sh # settings are located in $HOME/.corpus . $HOME/.corpus RSYNC_PASSWORD=$password export RSYNC_PASSWORD renice 10 -p $$ # use $PERL from env if unset if [ "x${PERL:-}" = x ] ; then PERL=perl fi set -x set -e # ensure we're running after 0900 UTC; complex due to daylight savings. # If we're running in the 08xx UTC hour-space, sleep for 1 hour; when # we wake, we will be in 09xx. ( TIME="%e,%U,%S"; TZ=UTC; export TIME TZ if date | egrep '^... ... .. 08:'; then date; echo "sleeping for 1 hour to compensate for DST" sleep 3600 ; date fi ) # day of week if date | egrep '^Sat' || [ "$1" = "net" ]; then net="net-" else net="" fi # enter tree cd $tree # find current revision rm -f weekly-versions.txt nightly-versions.txt if ! wget --tries=120 --wait=30 \ http://rsync.spamassassin.org/weekly-versions.txt \ http://rsync.spamassassin.org/nightly-versions.txt then echo "wget failed" 1>&2 exit 0 fi if [ -n "$net" ]; then revision=$(tail -1 weekly-versions.txt|awk '{print $2}') else revision=$(tail -1 nightly-versions.txt|awk '{print $2}') fi # update set +e retry=0 while true; do rm -rf rules # causing trouble for some reason rm -rf rulesrc/sandbox if svn update -r $revision < /dev/null && \ svn update -r $revision rulesrc < /dev/null then break; fi pkill -TERM svn sleep 10 pkill -KILL svn if svn update -r $revision < /dev/null && \ svn update -r $revision rulesrc < /dev/null then break; fi if [ $retry -eq 120 ]; then echo "svn update failed" 1>&2 exit 1 fi retry=$(( $retry + 1 )) sleep 20 done set -e # build $PERL Makefile.PL < /dev/null make # call ext command, if required if [ "x${pre_mass_check_command:-}" != x ] ; then $pre_mass_check_command fi # run test cd masses rm -f spamassassin/auto* rm -f spamassassin/bayes* rm -f razor-agent.log if [ -n "$net" ]; then prefs=$prefs_weekly opts=$opts_weekly else prefs=$prefs_nightly opts=$opts_nightly fi if [ -n "$prefs" -a -f "$prefs" ]; then cp $prefs spamassassin/user_prefs else rm -f spamassassin/user_prefs fi date | tee test.start $PERL mass-check $opts date | tee test.end uptime ls -l spam.log ham.log # results name mv spam.log spam-$net$username.log mv ham.log ham-$net$username.log # rsync set +e retry=0 while true; do if rsync -Pcvuzb --timeout=120 \ spam-$net$username.log ham-$net$username.log \ $username@rsync.spamassassin.org::corpus/ then break; fi if [ $retry -eq 120 ]; then echo "rsync failed" 1>&2 exit 1 fi retry=$(( $retry + 1 )) sleep 30 done set -e