[cvs] bogofilter/src bf_compact,1.7,1.8 bf_resize,1.1,1.2 bf_tar,1.6,1.7
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <re...@us...> - 2004-12-24 21:46:56
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25957/src Modified Files: bf_compact bf_resize bf_tar Log Message: Use bogoutil long option names, capitalize variables, and accept egrep's finding nothing. Index: bf_compact =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/bf_compact,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- bf_compact 14 Dec 2004 01:34:24 -0000 1.7 +++ bf_compact 24 Dec 2004 21:46:43 -0000 1.8 @@ -36,7 +36,7 @@ bogoutil -d "$ORIG"/"$FILE" | bogoutil -l $TEMP/"$FILE" #checkpoint and remove unneeded log files -bogoutil -P $TEMP +bogoutil --prune=$TEMP mv "$ORIG" "$ORIG.old" mv $TEMP "$ORIG" Index: bf_resize =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/bf_resize,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- bf_resize 3 Dec 2004 00:37:38 -0000 1.1 +++ bf_resize 24 Dec 2004 21:46:43 -0000 1.2 @@ -19,19 +19,19 @@ set -e -dir=${1:-.} +DIR=${1:-.} : ${DB_ARCHIVE:=db_archive} : ${AWK:=awk} a=0 -dbs=$(db_archive -s -a -h "$dir") +dbs=$(db_archive -s -a -h "$DIR") if [ ! "$dbs" ] ; then - echo >&2 "No database files in \"$dir\" found" + echo >&2 "No database files in \"$DIR\" found" exit 1 fi for i in $dbs ; do - pages=$(db_stat -h "$dir" -d "$i" \ + pages=$(db_stat -h "$DIR" -d "$i" \ | awk '/Number of tree leaf pages/ {print $1;}') a=$(( $a + $pages )) done @@ -39,9 +39,9 @@ # be generous a=$(( $a * 2 )) -touch "$dir"/DB_CONFIG -egrep -v '^set_lk_max_(locks|objects)' "$dir"/DB_CONFIG >"$dir"/DB_CONFIG.new -echo >>"$dir"/DB_CONFIG.new set_lk_max_locks $a -echo >>"$dir"/DB_CONFIG.new set_lk_max_objects $a -mv "$dir"/DB_CONFIG.new "$dir"/DB_CONFIG -bogoutil -f "$dir" +touch "$DIR"/DB_CONFIG +egrep -v '^set_lk_max_(locks|objects)' "$DIR"/DB_CONFIG >"$DIR"/DB_CONFIG.new || true +echo >>"$DIR"/DB_CONFIG.new set_lk_max_locks $a +echo >>"$DIR"/DB_CONFIG.new set_lk_max_objects $a +mv "$DIR"/DB_CONFIG.new "$DIR"/DB_CONFIG +bogoutil --recover="$DIR" Index: bf_tar =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/bf_tar,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- bf_tar 14 Dec 2004 01:34:24 -0000 1.6 +++ bf_tar 24 Dec 2004 21:46:43 -0000 1.7 @@ -11,12 +11,12 @@ set -e -removebef=0 -removeaft=0 +REMOVEBEF=0 +REMOVEAFT=0 while [ "$1" ] ; do case "$1" in - -r) removeaft=1 ;; - -R) removebef=1 ;; + -r) REMOVEAFT=1 ;; + -R) REMOVEBEF=1 ;; -*) echo >&2 "`basename $0`: unknown option $1" ; exit 1 ;; *) break; esac @@ -32,23 +32,23 @@ exit 1 fi -bogohome="$1" +BOGOHOME="$1" nukelogs() { - bogoutil -P "$bogohome" + bogoutil --prune="$BOGOHOME" } # run db_checkpoint to reduce number of logs -db_checkpoint -1 -h "$bogohome" +db_checkpoint -1 -h "$BOGOHOME" # remove if requested -if [ $removebef -eq 1 ] ; then nukelogs ; fi +if [ $REMOVEBEF -eq 1 ] ; then nukelogs ; fi # database first, if it's newer than the log, it's not recoverable! # pax options: -w: write archive, -v: verbosely, -x ustar: choose tar # format. -( db_archive -a -s -h "$bogohome" ; db_archive -a -l -h "$bogohome" ) \ +( db_archive -a -s -h "$BOGOHOME" ; db_archive -a -l -h "$BOGOHOME" ) \ | pax -w -v -x ustar # remove if requested -if [ $removeaft -eq 1 ] ; then nukelogs ; fi +if [ $REMOVEAFT -eq 1 ] ; then nukelogs ; fi |