online quarantine?
G. Armour Van Horn
vanhorn at whidbey.com
Wed Aug 27 01:16:47 IST 2003
Well, that "clean.quarantine" on both of my machines, but it is sitting right there
in plain view. I set it to 10 days rather than 30, I expect I'll never even look at
it again.
Thanks again, Julian.
Van
Julian Field wrote:
> If you've got one of the Linux distributions of MailScanner, you already
> have a "clean_quarantine" cron job in place. All you need to do to enable
> it is comment out the
> $disabled = 1;
> line right near the top of the script.
>
> And if you haven't already got it, here it is in all its glory.
>
> #!/usr/bin/perl
>
> #
> # IMPORTANT NOTE:
> #
> # Change the next line to 0 instead of 1 to enable this script.
> # By default it will be disabled and will not do anything.
> #
>
> $disabled = 1;
>
> $quarantine_dir = '/var/spool/MailScanner/quarantine';
> $days_to_keep = 30;
>
> exit if $disabled;
>
> # Standardise the format of the directory name
> die 'Path for quarantine_dir must be absolute' unless $quarantine_dir =~ /^\//;
> $quarantine_dir =~ s/\/$//; # Delete trailing slash
>
> # Now get the content list for the directory.
> opendir(QDIR, $quarantine_dir) or die "Couldn't read directory
> $quarantine_dir";
>
> # Loop through this list looking for any *directory* which hasn't been
> # modified in the last $days_to_keep days.
> # Unfortunately this will do nothing if the filesystem is backed up using tar.
> while($entry = readdir(QDIR)) {
> next if $entry =~ /^\./;
> $entry = $quarantine_dir . '/' . $entry;
> system("rm -rf $entry") if -d $entry &&
> -M $entry > $days_to_keep;
> }
> closedir(QDIR);
>
> At 15:29 26/08/2003, you wrote:
> >S Mohan wrote:
> > > Another alternative is
> > >
> > > find /path/to/quarantine -ctime +7 | xargs rm -rf
> > >
> >Yes, but that would delete directories that may have more recent
> >contents. On the other hand my original line neglected to consider that
> >there may be directories involved.
> >
> >Thinking a bit more clearly than I was when I originally posted you
> >probably also need a -depth in there, and append a /* to the path to avoid
> >deleting the quarantine dir itself, plus some conditional stuff to get rid
> >of directories. So...
> >
> >find /path/to/quarantine/* -ctime +7 -depth \! \( -type d -exec rmdir {}
> >';' \) -exec rm -f {} ';'
> >
> >This does rely on rmdir failing when the directory is not empty, so you'll
> >also want to append
> >
> > >/dev/null 2>&1
> >
> >once its tested.
> >
> >
> >
> >
> >
> >
> >
> >BMRB International
> >http://www.bmrb.co.uk
> >+44 (0)20 8566 5000
> >_________________________________________________________________
> >This message (and any attachment) is intended only for the
> >recipient and may contain confidential and/or privileged
> >material. If you have received this in error, please contact the
> >sender and delete this message immediately. Disclosure, copying
> >or other action taken in respect of this email or in
> >reliance on it is prohibited. BMRB International Limited
> >accepts no liability in relation to any personal emails, or
> >content of any email which does not directly relate to our
> >business.
>
> --
> Julian Field
> www.MailScanner.info
> MailScanner thanks transtec Computers for their support
--
----------------------------------------------------------
Sign up now for Quotes of the Day, a handful of quotations
on a theme delivered every morning.
Enlightenment! Daily, for free!
mailto:twisted at whidbey.com?subject=Subscribe_QOTD
For web hosting and maintenance,
visit Van's home page: http://www.domainvanhorn.com/van/
----------------------------------------------------------
More information about the MailScanner
mailing list