I've dealt with this may times. the best way is to use the find
command. I use this by manually going into the spam folder and running
a small script. I'll dig up the script in a few minutes but its
basically find . 'sudo vpopmail -H --spam []' just be sure and run in
it in the directory you want it to delete the messages from.
I'll dig it up but that will handle them 1 at a time. If anyone wants
to work on this I'd be willing to throw in some work on it. The cron
script runs away on our older server since it can't finish in a hour and
after a few hours the machine runs out of memory and the phone starts
ringing.
just my 2 cents but I think the script should:
have a limited memory/ cpu overhead usage built in (don't know how to do
this to a script)
Process mail 1 at a time so when you find an old email account with
2 spam it won't crash and die.
Have some reporting features built in. for example when it's run
manually it will say now cleaning spam for
f...@flintstone.com learned 27 messsages as spam moving to
wil...@flinstone.com learned 88 messages as spam...etc
Dan
On Mon, 2008-12-08 at 16:35 -0700, Chris Hillman wrote:
It seems to me the best way to fix the script for large amounts of
work it to create a function in the shell script like this…
function larger_mv ()
{ while read line1; do
md5sum directory/$line1 ~/md5sums
ls -l directory/$line1 ~/backup_list
mv directory/$line1 ../directory2
done
}
ls -1 directory/ | larger_mv
Example 3b demonstrates how you easily can get an md5sum and a backup
listing of each file before moving it.
Unfortunately, since this method also requires that each file be dealt
with individually, it will involve a delay similar to that of Method
#2. From experience I have found that Method #2 is a little faster
than the function given in Example 3a, so Method #3 should be used
only in cases where the extra functionality is required.
Taken from http://www.linuxjournal.com/article/6060
From: Kyle Quillen [mailto:kquil...@corp.wifi7.com]
Sent: Monday, December 08, 2008 4:24 PM
To: qmailtoaster-list@qmailtoaster.com
Subject: RE: Re: [qmailtoaster] Error Running qtp-clean-spam
Eric,
Thanks for the quick script
it threw this error..
cleanspam.sh: line 14: /bin/ls: Argument list too long
Is there a command that we can run to just delete these without
pumping them into sa-learn
Thanks
Q
__
From: news on behalf of Eric Shubert
Sent: Mon 12/8/2008 4:46 PM
To: qmailtoaster-list@qmailtoaster.com
Subject: Re: [qmailtoaster] Error Running qtp-clean-spam
That script really should be fixed. In the meantime, this should work:
(substitute mydomain appropriately)
for maildir in `ls -d /home/vpopmail/domains/mydomain/*/Maildir`; do
shopt -s extglob
for spamfile in `find $maildir/+(cur|new)/* 2/dev/null`; do
sudo -u vpopmail -H sa-learn --$learnas $spamfile
rc=$?
if [ $? != 0 ]; then
echo sa-learn failed, rc=$rc, spamfile=$spamfile
exit $rc
fi
rm $spamfile
done
done
Please report back your result.
Kyle Quillen wrote:
Well there are about 3000 accounts on this server so it is going to
be pretty hard to drill down which folder it is bombing on
thanks
q
From: Chris Hillman [mailto:chill...@clearwater-research.com]
Sent: Mon 12/8/2008 1:49 PM
To: qmailtoaster-list@qmailtoaster.com
Subject: RE: [qmailtoaster] Error Running qtp-clean-spam
Rather than modify the script, just create a temp imap folder...
'temp-spam' or something and move half of the messages there
temporarily. Run the script. After completion move them back and run
again. Hopefully it will complete successfully.
-Chris
From: Kyle Quillen [mailto:kquil...@corp.wifi7.com]
Sent: Monday, December 08, 2008 11:41 AM
To: qmailtoaster-list@qmailtoaster.com
Subject: RE: [qmailtoaster] Error Running qtp-clean-spam
any insight on how to modify the script? I do not know scripting
all that well and don't want to botch things
Thanks
Q
From: Jake Vickers [mailto:j...@v2gnu.com]
Sent: Mon 12/8/2008 1:36 PM
To: qmailtoaster-list@qmailtoaster.com
Subject: Re: [qmailtoaster] Error Running qtp-clean-spam
Kyle Quillen wrote:
Hello all,
When I try to run the qtp-clean-spam script it comes back with an
error message that finds argument list is too long. Can anyone point
in a direction as to how to clear this up.
You have too many messages in one folder - you can either break the
messages up into 2 directories and learn them