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:[EMAIL PROTECTED] 
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:[EMAIL PROTECTED]
> 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:[EMAIL PROTECTED]
> 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:[EMAIL PROTECTED]
> 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 that way, or modify the
script to use another find command to pipe the output to the sa-learn
command.
>
>
>
>
------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
>      QmailToaster hosted by: VR Hosted <http://www.vr.org
<http://www.vr.org/> >
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]


--
-Eric 'shubes'


---------------------------------------------------------------------
     QmailToaster hosted by: VR Hosted <http://www.vr.org
<http://www.vr.org/> >
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to