On Fri, 2004-04-16 at 22:58, Craig Ringer wrote: A message in which he failed to actually attach the file he was talking about. It's attached this time, as text/plain so that overzealous mail scanners don't remove it.
Craig Ringer
#!/bin/bash # # /var/tmp/scan/clamout is a file containg the output from the # initial clamscan run. # # Clamscan output lines for detected viri look like this: # /var/spool/imap/user/bob/subfolder/123.: FOUND W32.Virus # grep FOUND /var/tmp/scan/clamout > /var/tmp/scan/infected # Back up the messages to be deleted cat /var/tmp/scan/infected |\ cut -d ':' -f 1 |\ cpio -o -H crc > /var/spool/clam_quarantine/infected-mail-`date -I`.cpio # Delete the viruses from the spool rm -fv $(cat /var/tmp/scan/infected | cut -d ':' -f 1) # and rebuild altered mailboxes reconstruct $(cat /var/tmp/scan/infected |\ grep '/var/spool/imap/' |\ cut -d '/' -f 5- |\ cut -d ':' -f 1 |\ xargs -n 1 dirname |\ tr '/' '.' |\ sort | uniq)