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.
[EMAIL PROTECTED] bin $ cat clear_up_spam.sh
#!/bin/sh
for i in `ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur`; do
sudo rm $i; done
[EMAIL PROTECTED] 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