mailscanner quarantine items
Miguel van Loon
m.van.loon at ictvanloon.nl
Wed Jan 4 17:25:29 UTC 2017
I get "crontab: errors in crontab file, can't install"
I am trying to add a script to crontab that will delete quarantined items out of /var/spool/Mailscanner/quarantine
Anotherone sayed I coud add it straight to crontab, but no results..
This is the script:
#!/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 = 0;
$quarantine_dir = '/var/spool/MailScanner/quarantine';
$days_to_keep = 20;
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);
Thanks!
---------------------------------------------------------------------------------------------------------------------------------------------------------
On Wednesday 04 January 2017 at 18:09:08, Miguel van Loon wrote:
> can not add because there would be gives errors in crontab to..
What error do you get?
> Also an idea why?
What are you trying to add to crontab to get the error?
> Or is it easier to create a file and put it somewhere for crontab?
I'm not sure what you mean by this - you *are* saving the script somewhere like /usr/local/bin/scriptname and then adding an entry to crontab to run that script, aren't you?
Tell what you're doing and what goes wrong, and we may be able to help.
Antony.
--
This is not a rehearsal.
This is Real Life.
Please reply to the list;
please *don't* CC me.
--
MailScanner mailing list
mailscanner at lists.mailscanner.info
http://lists.mailscanner.info/mailman/listinfo/mailscanner
More information about the MailScanner
mailing list