#!/usr/bin/perl -w -T use strict; use File::Spec; my $PREFIX = '@@PREFIX@@'; # substituted at 'make' time my $DEF_RULES_DIR = '@@DEF_RULES_DIR@@'; # substituted at 'make' time my $LOCAL_RULES_DIR = '@@LOCAL_RULES_DIR@@'; # substituted at 'make' time use lib '@@INSTALLSITELIB@@'; # substituted at 'make' time BEGIN { # Locate locally installed SA libraries *without* using FindBin, which generates # warnings and causes more trouble than its worth. We don't need to be too # smart about this BTW. my @bin = File::Spec->splitpath($0); my $bin = ($bin[0] ? File::Spec->catpath(@bin[0..1]) : $bin[1]) # /home/jm/foo -> /home/jm || File::Spec->curdir; # foo -> . # check to make sure it wasn't just installed in the normal way. # note that ./lib/Mail/SpamAssassin.pm takes precedence, for # building SpamAssassin on a machine where an old version is installed. if (-e $bin.'/lib/Mail/SpamAssassin.pm' || !-e '@@INSTALLSITELIB@@/Mail/SpamAssassin.pm') { # These are common paths where the SA libs might be found. foreach (qw(lib ../lib/site_perl ../lib/spamassassin ../share/spamassassin/lib)) { my $dir = File::Spec->catdir($bin, split('/', $_)); if(-f File::Spec->catfile($dir, "Mail", "SpamAssassin.pm")) { unshift(@INC, $dir); last; } } } } require Mail::SpamAssassin::CmdLearn; exit Mail::SpamAssassin::CmdLearn::cmdline_run ({ rebuildonly => 1 }); # --------------------------------------------------------------------------- =head1 NAME sa-learn-rebuild - rebuild spamassassin's Bayesian statistics databases =head1 SYNOPSIS B [options] Options: --showdots Show progress using dots --force-expire Force an expiry run -C file, --config-file=file Path to standard configuration dir -p prefs, --prefs-file=file Set user preferences file -D, --debug-level Print debugging messages -V, --version Print version -h, --help Print usage message =head1 DESCRIPTION This command allows busy sites to control the expiration of 'obsolete' data from SpamAssassin's Bayesian statistics databases. Some sites may wish to choose times to update the databases; they should run this command from a scheduling service like C. This is purely optional -- by default, SpamAssassin will automatically expire old data once daily. In addition, if SpamAssassin's learning commands, namely B, B, and B, are run with the C<--no-rebuild> option, this command is required in order to complete the learning process. See B for more details on SpamAssassin's Bayesian filtering system. =head1 OPTIONS =over 4 =item B<--showdots> Print a '.' character, as a progress meter. =item B<--force-expire> Force a database expiration run. Normally, tokens are expired twice every C days. =item B<-h>, B<--help> Print help message and exit. =item B<-C> I, B<--config-file>=I Read configuration from I. =item B<-p> I, B<--prefs-file>=I Read user score preferences from I. =item B<-D>, B<--debug-level> Produce diagnostic output. =back =head1 INSTALLATION The B command is part of the B Perl module. Install this as a normal Perl module, using C, or by hand. =head1 ENVIRONMENT No environment variables, aside from those used by perl, are required to be set. =head1 SEE ALSO Mail::SpamAssassin(3) spamassassin(1) sa-learn-spam(1) sa-learn-nonspam(1) sa-forget(1) =head1 AUTHOR Justin Mason Ejm /at/ jmason.orgE =cut