You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Jonathan Nichols <jn...@pbp.net> on 2005/06/15 00:37:00 UTC

Dumb script question

I have POP/IMAP/SMTP on a seperate box from the spamassassin/amavis box, 
and I'm trying to come up with a script to take stuff out of the 
shared-maildir where users deposit spam that slipped through, tar it up, 
and move it to the other box, where yet another script will feed it to 
bayes.

Most everything works, except for the cleanup! For the life of me, I 
can't manage to not screw this step up. heh.

jnichols@mail bin $ cat clear_up_spam.sh
#!/bin/sh
for i in `ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur`; do 
sudo rm $i; done
jnichols@mail bin $

Ok, so if I do a ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur 
then I see all the files in the directory.

If I run this script as it is, i get stuff like this:

rm: cannot remove 
`1118786978.M908087P32756V0000000000000303I0010F8DD_119.mail,S=2390:2,S': 
No such file or directory
rm: cannot remove 
`1118786978.M908337P32756V0000000000000303I0010F8DE_120.mail,S=2381:2,S': 
No such file or directory
rm: cannot remove 
`1118786978.M908585P32756V0000000000000303I0010F8DF_121.mail,S=2381:2,S': 
No such file or directory
rm: cannot remove 
`1118786978.M908831P32756V0000000000000303I0010F8E0_122.mail,S=1910:2,S': 
No such file or directory
rm: cannot remove 
`1118786978.M909071P32756V0000000000000303I0010F8E1_123.mail,S=2456:2,S': 
No such file or directory
rm: cannot remove 
`1118786978.M909318P32756V0000000000000303I0010F8E2_124.mail,S=3858:2,S': 
No such file or directory
rm: cannot remove 
`1118787339.M455809P32750V0000000000000303I0010F695_10.mail,S=2855:2,S': 
No such file or directory

if I do "cd /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur" and then 
"for i in `ls`; do sudo rm $i; done it works just fine. I just can't 
manage to delete the files *without* actually sitting there and manually 
going into the directory and deleting them. (I know the "for, do" loop 
is probably slow but I also screw up xargs every time I try to use it.)

Most everyone on here could probably beat me at shell scripting and 
Perl, and this is totally spamassassin stuff related, so I'm asking.. 
help me! :)

-Jonathan
Scripting idiot

Re: Dumb script question

Posted by Rick Macdougall <ri...@nougen.com>.
Matt Kettler wrote:

>Jonathan Nichols wrote:
>  
>
>>>Hi,
>>>
>>>for i in `ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur`; do
>>>sudo rm /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur/$i; done
>>>
>>>Although imapsalearn is easier.
>>>
>>>Regards,
>>>
>>>Rick
>>>
>>>      
>>>
>>I should get an extra shot of espresso when I hit up the coffee shop in
>>the morning. That worked fine. thanks :D
>>
>>but, what is this imapsalearn you speak of? Google tells me "Your search
>>- imapsalearn - did not match any documents. "
>>
>>    
>>
>
>I assume he means imap-sa-learn.pl:
>
>http://tirian.magd.ox.ac.uk/~nick/code/
>  
>

Hi,

Yup. that's the one I use.  I recognise a programmers web page :)

Regards,

Rick


Re: Dumb script question

Posted by Matt Kettler <mk...@evi-inc.com>.
Jonathan Nichols wrote:
> 
>> Hi,
>>
>> for i in `ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur`; do
>> sudo rm /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur/$i; done
>>
>> Although imapsalearn is easier.
>>
>> Regards,
>>
>> Rick
>>
> 
> I should get an extra shot of espresso when I hit up the coffee shop in
> the morning. That worked fine. thanks :D
> 
> but, what is this imapsalearn you speak of? Google tells me "Your search
> - imapsalearn - did not match any documents. "
> 

I assume he means imap-sa-learn.pl:

http://tirian.magd.ox.ac.uk/~nick/code/


Re: imapsalearn for SpamAssassin

Posted by jdow <jd...@earthlink.net>.
Bleah - meant to forward it and sent it to the list. Me sorry.
{o.o}
----- Original Message ----- 
From: "jdow" <jd...@earthlink.net>
To: <us...@spamassassin.apache.org>
Sent: 2005 June, 14, Tuesday 17:21
Subject: imapsalearn for SpamAssassin


> This is the trick for drawing from imap via a script directly for salearn
> purposes. It might be slower than my way but it's more "kosher".
>
> {^_^}
> ----- Original Message ----- 
> From: "Rick Macdougall" <ri...@nougen.com>
>
>
> > Jonathan Nichols wrote:
> >
> > >
> > > I should get an extra shot of espresso when I hit up the coffee shop
> > > in the morning. That worked fine. thanks :D
> > >
> > > but, what is this imapsalearn you speak of? Google tells me "Your
> > > search - imapsalearn - did not match any documents. "
> > >
> > > :(
> >
> > Hi,
> >
> > Glad it worked.  I should have said imap sa-learn and a google search
> > would have turned it right up.
> >
> > http://wiki.apache.org/spamassassin/RemoteImapFolder
> >
> > I use the dmzs (http://www.dmzs.com/tools/files/spam.phtml) program here
> > (or something very similar, I installed it a year or more ago so I'm not
> > sure which exact program I'm using)
> >
> > Regards,
> >
> > Rick



imapsalearn for SpamAssassin

Posted by jdow <jd...@earthlink.net>.
This is the trick for drawing from imap via a script directly for salearn
purposes. It might be slower than my way but it's more "kosher".

{^_^}
----- Original Message ----- 
From: "Rick Macdougall" <ri...@nougen.com>


> Jonathan Nichols wrote:
> 
> >
> > I should get an extra shot of espresso when I hit up the coffee shop 
> > in the morning. That worked fine. thanks :D
> >
> > but, what is this imapsalearn you speak of? Google tells me "Your 
> > search - imapsalearn - did not match any documents. "
> >
> > :(
> 
> Hi,
> 
> Glad it worked.  I should have said imap sa-learn and a google search 
> would have turned it right up.
> 
> http://wiki.apache.org/spamassassin/RemoteImapFolder
> 
> I use the dmzs (http://www.dmzs.com/tools/files/spam.phtml) program here 
> (or something very similar, I installed it a year or more ago so I'm not 
> sure which exact program I'm using)
> 
> Regards,
> 
> Rick


Re: Dumb script question

Posted by Rick Macdougall <ri...@nougen.com>.
Jonathan Nichols wrote:

>
> I should get an extra shot of espresso when I hit up the coffee shop 
> in the morning. That worked fine. thanks :D
>
> but, what is this imapsalearn you speak of? Google tells me "Your 
> search - imapsalearn - did not match any documents. "
>
> :(

Hi,

Glad it worked.  I should have said imap sa-learn and a google search 
would have turned it right up.

http://wiki.apache.org/spamassassin/RemoteImapFolder

I use the dmzs (http://www.dmzs.com/tools/files/spam.phtml) program here 
(or something very similar, I installed it a year or more ago so I'm not 
sure which exact program I'm using)

Regards,

Rick


Re: Dumb script question

Posted by Jonathan Nichols <jn...@pbp.net>.
> Hi,
> 
> for i in `ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur`; do 
> sudo rm /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur/$i; done
> 
> Although imapsalearn is easier.
> 
> Regards,
> 
> Rick
> 

I should get an extra shot of espresso when I hit up the coffee shop in 
the morning. That worked fine. thanks :D

but, what is this imapsalearn you speak of? Google tells me "Your search 
- imapsalearn - did not match any documents. "

:(

Re: Dumb script question

Posted by Rick Macdougall <ri...@nougen.com>.
Jonathan Nichols wrote:

> I have POP/IMAP/SMTP on a seperate box from the spamassassin/amavis 
> box, and I'm trying to come up with a script to take stuff out of the 
> shared-maildir where users deposit spam that slipped through, tar it 
> up, and move it to the other box, where yet another script will feed 
> it to bayes.
>
> Most everything works, except for the cleanup! For the life of me, I 
> can't manage to not screw this step up. heh.
>
> jnichols@mail bin $ cat clear_up_spam.sh
> #!/bin/sh
> for i in `ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur`; do 
> sudo rm $i; done
> jnichols@mail bin $
>
> Ok, so if I do a ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur 
> then I see all the files in the directory.
>
> If I run this script as it is, i get stuff like this:
>
> rm: cannot remove 
> `1118786978.M908087P32756V0000000000000303I0010F8DD_119.mail,S=2390:2,S': 
> No such file or directory
> rm: cannot remove 
> `1118786978.M908337P32756V0000000000000303I0010F8DE_120.mail,S=2381:2,S': 
> No such file or directory
> rm: cannot remove 
> `1118786978.M908585P32756V0000000000000303I0010F8DF_121.mail,S=2381:2,S': 
> No such file or directory
> rm: cannot remove 
> `1118786978.M908831P32756V0000000000000303I0010F8E0_122.mail,S=1910:2,S': 
> No such file or directory
> rm: cannot remove 
> `1118786978.M909071P32756V0000000000000303I0010F8E1_123.mail,S=2456:2,S': 
> No such file or directory
> rm: cannot remove 
> `1118786978.M909318P32756V0000000000000303I0010F8E2_124.mail,S=3858:2,S': 
> No such file or directory
> rm: cannot remove 
> `1118787339.M455809P32750V0000000000000303I0010F695_10.mail,S=2855:2,S': 
> No such file or directory
>
> if I do "cd /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur" and 
> then "for i in `ls`; do sudo rm $i; done it works just fine. I just 
> can't manage to delete the files *without* actually sitting there and 
> manually going into the directory and deleting them. (I know the "for, 
> do" loop is probably slow but I also screw up xargs every time I try 
> to use it.)
>
> Most everyone on here could probably beat me at shell scripting and 
> Perl, and this is totally spamassassin stuff related, so I'm asking.. 
> help me! :)
>
> -Jonathan
> Scripting idiot

Hi,

for i in `ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur`; do 
sudo rm /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur/$i; done

Although imapsalearn is easier.

Regards,

Rick