📄 bf_tar
字号:
#! /bin/sh# This file dumps a bogofilter to standard output in POSIX-tar format.## Requires: pax## (C) 2004 by Matthias Andree# GNU GPL v2.# $Id: bf_tar.in,v 1.4 2005/05/16 11:24:09 relson Exp $set -eREMOVEBEF=0REMOVEAFT=0while [ "$1" ] ; do case "$1" in -r) REMOVEAFT=1 ;; -R) REMOVEBEF=1 ;; --) shift ; break ;; -*) echo >&2 "`basename $0`: unknown option $1" ; exit 1 ;; *) break; esac shiftdoneif [ $# -ne 1 ] ; then echo >&2 "Usage: `basename $0` [options] bogodir > outfile.tar" echo >&2 " or: `basename $0` [options] bogodir | gzip -c >outfile.tar.gz" echo >&2 'Options are:' echo >&2 ' -r - remove inactive log files after archiving' echo >&2 ' -R - remove inactive log files before archiving (use with caution)' exit 1fi# we could write $1 for the moment being as we demand exactly this# argument above [ $# -ne 1 ]BOGOHOME=${1:-.}if [ ! -d "$BOGOHOME" ] ; then echo $BOGOHOME must be a directory, not a file exit 1finukelogs() { bogoutil --db-prune="$BOGOHOME"}# remove if requestedif [ $REMOVEBEF -eq 1 ] ; then nukelogselse bogoutil --db-checkpoint="$BOGOHOME"fi# database first, then the logs.# the log MUST be newer than the database, if it's the other way around,# that state will not be recoverable!## pax options: -w: write archive, -v: verbosely, -x ustar: pick tar format.( c="${BOGOHOME}/DB_CONFIG" if [ -f "$c" ] ; then echo "$c" ; fi bogofilter -QQ -d "$BOGOHOME" | grep '^wordlist ' | cut -f3 -d, bogoutil --db-list-logfiles="$BOGOHOME" all) | pax -w -v -x ustar# remove if requestedif [ $REMOVEAFT -eq 1 ] ; then nukelogs ; fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -