DATABASE - RECOVERY
It is possible to corrupt the Berkeley DB environment or one or more of the databases if a task is shutdown unexpectedly with the databases open.
If your SpamCannibal installation runs the sc_dbwatch daemon then database recovery is ordinarily done automatically. In the event things fail badly, you can check for a corrupted database by attempting to view one or more of the databases with sc_admin.pl. If you are running sc_BLcheck.pl periodically then the order of the databases by size is usually as shown below. If you can not view one or more of the databases then then the environment and/or the databases have been corrupted and the Berkeley DB db_recover program should be run.
To view:
./sc_admin archive view (small) ./sc_admin blcontrib view (large) ./sc_admin evidence view ./sc_admin tarpit view
If the databases appear to be corrupted, you should be able to restore the database environment running the recovery procedure. Stop all SpamCannibal daemons that access the database then su - root and type:
cd /usr/local/spamcannibal/scripts ./sc_initdb -R
If that does not work then use the manual procedure. Stop all SpamCannibal daemons that access the database and run db_recover.
rc.sc_dbwatch stop or rc.dbtarpit stop rc.bdbaccess stop rc.dnsbls stop you must also block any Cron jobs cd /var/run/dbtarpit db_recover -v
If that still does not work then use the sc_recoverdb.pl script to verify/copy the records from the existing database files to new files, then replace the old files with the new. su - root and type FOR EACH DB FILE (typically tarpit, archive, blcontrib, evidence):
cd /usr/local/spamcannibal/scripts ./sc_recoverdb.pl -v tarpit
If the DB fails to verify, then type:
./sc_recoverdb.pl tarpit cd /var/run/dbtarpit mv tarpit.new tarpit
Ok, so none of that worked either. As a last resort, you can dump a damaged database file using Berkeley DB's db_dump and the reload it with db_load.
To reinitialize the database environment su - root and type:
cd /usr/local/spamcannibal/scripts ./sc_initdb.pl
Restart the SpamCannibal daemons that were previously running.
rc.sc_dbwatch start or rc.dbtarpit start rc.sc_lbdaemon start rc.bdbaccess start rc.dnsbls start
To install Mail::SpamCannibal, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::SpamCannibal
CPAN shell
perl -MCPAN -e shell install Mail::SpamCannibal
For more information on module installation, please visit the detailed CPAN module installation guide.