mailscanner quarantine items

Jason Waters jason at geeknocity.com
Wed Jan 4 16:46:48 UTC 2017


Yeah they already have a script made in tools or something like that.  You
just need to configure it and then set it up to auto run.

Jason

On Wed, Jan 4, 2017 at 11:44 AM, Miguel van Loon <m.van.loon at ictvanloon.nl>
wrote:

> I guess I can use a script like this..?
>
>
>
> #!/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);
>
>
>
> I also remembered I can put it in crontab –e
>
>
>
> Thanks for so far!
>
> *Van:* MailScanner [mailto:mailscanner-bounces+m.van.loon=
> ictvanloon.nl at lists.mailscanner.info] *Namens *Jason Waters
> *Verzonden:* woensdag 4 januari 2017 16:57
> *Aan:* MailScanner Discussion <mailscanner at lists.mailscanner.info>
> *Onderwerp:* Re: mailscanner quarantine items
>
>
>
> type crontab -e  then hit enter.  Then setup your job there.  I think that
> should work for you.
>
>
>
> On Wed, Jan 4, 2017 at 7:37 AM, Miguel van Loon <m.van.loon at ictvanloon.nl>
> wrote:
>
> Hello,
>
>
>
> I’m running mailscanner on freebsd and I am trying to create a cron job to
> delete emails out of the /var/spool/mailscanner/quarantine log.
>
> However you can’t do it this way because there is no cron.daily..
>
>
>
> Does someone know how to add or config this?
>
>
>
> Thanks for help!
>
>
>
>
>
>
>
> --
> MailScanner mailing list
> mailscanner at lists.mailscanner.info
> http://lists.mailscanner.info/mailman/listinfo/mailscanner
> <http://g3hx.mjt.lu/lnk/AEQAHJsjlnQAAAAAAAAAAGoWcEUAARpY35AAAAAAAAci1wBYbSZ7wbsuKwgmT0mrkbj9K3JGaAAGzxo/1/sLNMTszXzErzUzbUUnHUtA/aHR0cDovL2xpc3RzLm1haWxzY2FubmVyLmluZm8vbWFpbG1hbi9saXN0aW5mby9tYWlsc2Nhbm5lcg>
>
>
>
>
>
>
> --
> MailScanner mailing list
> mailscanner at lists.mailscanner.info
> http://lists.mailscanner.info/mailman/listinfo/mailscanner
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mailscanner.info/pipermail/mailscanner/attachments/20170104/9b055adb/attachment.html>


More information about the MailScanner mailing list