ifile-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ifile-discuss] Re: Effect of widely differing volumes on ifile classif


From: clemens fischer
Subject: [Ifile-discuss] Re: Effect of widely differing volumes on ifile classification
Date: 20 Mar 2003 20:16:11 +0100
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50 (berkeley-unix)

"Brett Nemeroff" <address@hidden>:

> I know this is slightly off topic, but I was wondering if you had
> custom scripts you could share that would report accuracy as you
> have in this post?

most of us use some shell script accounting refiles.  so you don't
use ifile directly, but through a script that calls ifile and counts,
and another script also calling ifile for refiles this time, updating
another counter.

i have these:

--- 8< ---
#!/bin/sh
# $Header: /root/bin/RCS/ifile-l,v 1.1.1.4 2002/08/20 18:15:59 root Exp root $
/usr/local/bin/ifile -cQ && /root/bin/ifile-ll ifile || echo "${1:-ERROR}"

--- 8< ---
#!/bin/sh
# $Header: /root/bin/RCS/ifile-ll,v 1.1.1.1 2002/03/13 13:57:14 root Exp $
# accuracy update
debug=true
#debug=echo
case "${1:-ifile}" in
ifile)
        bumpifile=1
        bumpirefile=0
        ;;
irefile)
        bumpifile=0
        bumpirefile=1
        ;;
*)
        bumpifile=0
        bumpirefile=0
        ;;
esac
accfn="${HOME}/.idata.acc"
acclck="${HOME}/.idata.acclck"
if [ -f "${accfn}" ]; then
        if lockfile -r0 -l1024 "$acclck" 2>/dev/null; then
                trap "rm -f ${acclck}" 1 2 3 13 15
                accifile=$(head -1 "$accfn")
                accirefile=$(tail -1 "$accfn")
                $debug acc: $accifile $accirefile
                $debug bump: $bumpifile $bumpirefile
                accifile=$(($accifile + $bumpifile))
                accirefile=$(($accirefile + $bumpirefile))
                $debug acc: $accifile $accirefile
                echo $accifile > $accfn
                echo $accirefile >> $accfn
        fi
elif lockfile -r0 -l1024 "$acclck" 2>/dev/null; then
        trap "rm -f ${acclck}" 1 2 3 13 15
        accfn="${HOME}/.idata.acc"
        echo 1 > $accfn
        echo 0 >> $accfn
fi
rm -f "${acclck}"

--- 8< ---
#!/bin/sh
# $Header: /root/bin/RCS/irefile,v 0.1.1.7 2002/09/01 16:00:21 root Exp root $

#debug=echo
debug=true

usage () {
        echo "usage: $0 <from> [<to>].  this will take the message
on stdin out the <from>-folder and into <to>.  in two-folder anti-spam
systems the <to>-folder is implied, but has to be confirmed."
}

case "$0" in
*inbox) exec irefile INBOX
        ;;
*spam)  exec irefile spam
        ;;
esac

[ "x$1" = "x" ] && {
        usage
        exit 1
}

idata=${HOME}/.idata
from="$1" to="$2"

TMPDIR=${TMPDIR:=/tmp}
TMPFILE=`mktemp -t irefile` || exit 1
cat > $TMPFILE

confirm=true
[ "x$2" = "x" ] && {
        confirm=echo
}

folders=$(head -1 $idata)
nfolders=0
for i in $folders; do nfolders=$(($nfolders + 1)); done

[ "x$to" = "x" ] && {
        [ $nfolders -gt 2 ] && {
                echo "nfolders: $nfolders, no implicit <to> possible."
                exit 2
        }
        case "$from" in
        "spam") to=INBOX
                ;;
        "INBOX") to=spam
                ;;
        *)
                echo "from: $from, must be {spam, INBOX}."
                exit 2
                ;;
        esac
}
#setlock /tmp/ifile.lck ifile -d "$from" < $TMPFILE &&
#setlock /tmp/ifile.lck ifile -i "$to" < $TMPFILE &&
#ifile -d "$from" -u "$to" < $TMPFILE &&
ifile -d "$from" -i "$to" < $TMPFILE &&
ifile -q < $TMPFILE &&
rm -f $TMPFILE &&
ifile-ll irefile &&
$confirm "$0: ok." &&
exit 0

ex=$?
$confirm "$0 returned $ex: not ok, $TMPFILE not removed."
exit $ex
--- 8< ---

  clemens




reply via email to

[Prev in Thread] Current Thread [Next in Thread]