Auto-clearing not working, is there something else I need to do?

6 posts / 0 new
Last post
#1 Mon, 06/12/2017 - 06:40
amityweb

Auto-clearing not working, is there something else I need to do?

I have set Auto-Clearing to delete emails older than 60 days in the Sent Messages folder. I did this last week, but several days later its not deleted any. Still over 9Gb of emails in there as last week.

So is there some other setting to enable this? When is it supposed to run (daily, weekly?). Does it need a cron entry setup? Or does it it have an issue?

Thanks

Thu, 06/15/2017 - 01:39
ksihota

I just tested Auto-clearing on one of my folders and it worked as expected.

I am not sure what initiated the actual deletion but it happened quite soon after I set the Auto-clearing preferences. Interestingly the messages and count in the right Mail panel of Usermin showed the change but the message count next to the folder in the left panel still showed the old count. It required me to reload the panel to see the updated count. I guess the deletion must have occurred when I switched from the Auto-clearing preference page to the mail so the page reloaded then.

I believe that the first time I set the auto-clearing it didn't update right away but I am not sure how long it took as I left the computer for about an hour to do something else. Just to check I went back in and decreased the number of days to save emails for and when I switched back and looked it hadn't removed any extras. So there has to be some kind of timed event. I just don't know what it is. It does not appear to be event driven as I tried selecting different links and logging out and back in and the deletions did not occur.

I checked the Cron jobs for the server and found this one that runs once an hour: /home/domain/homes/user/.usermin/mailbox/auto.pl

I tried running it manually but it did not delete the additional emails.

#!/usr/bin/perl
open(CONF, "/etc/usermin/miniserv.conf") || die "Failed to open /etc/usermin/miniserv.conf : $!";
while(<CONF>) {
        $root = $1 if (/^root=(.*)/);
        }
close(CONF);
$root || die "No root= line found in /etc/usermin/miniserv.conf";
$ENV{'PERLLIB'} = "$root";
$ENV{'WEBMIN_CONFIG'} = "/etc/usermin";
$ENV{'WEBMIN_VAR'} = "/var/usermin";
chdir("$root/mailbox");
exec("$root/mailbox/auto.pl", @ARGV) || die "Failed to run $root/mailbox/auto.pl : $!";

I have not done much in Perl so I really don't know what this does. I'm guessing that it uses the info saved for Auto-clearing and completes the task(s) I am not sure why it wouldn't work when I ran it manually (though cron.)

The message deletion just occurred but it was 1 minute before the scheduled cron job so I will assume that the Auto-clearing takes place once per hour based on the time the first job was set up.

If yours is still not working you might want to check the cron job /home/domain/homes/user/.usermin/mailbox/auto.pl and see if that is the issue.

EDIT
What an idiot I am.

I have two domains mydomain.net and mydomain.ca
I was testing my Usermin stuff using mydomain.ca but viewing the cron job for mydomain.net
It just happened that the creation time of my Auto-clearing setups were just minutes apart.
In fact the cron job ran when it was supposed to and the manual run wasn't working because I was looking at the wrong mail folder.

Final result: The Auto-clearing works fine. It uses a cron job /home/domain/homes/user/.usermin/mailbox/auto.pl which is set up to run once an hour.

Fri, 06/16/2017 - 16:16
amityweb

Strange, I do not have an auto.pl file in this mail folder. I have cron jobs and this file in a couple of other folders, but not the one I created the auto clearing for. Maybe thats why its not working, but then it asks the question why it was not created.

Fri, 06/16/2017 - 17:04
ksihota

The specific cron job I am referring to is in my main server (root) account, not the individual domain account. Are you checking there? I don't see it if I don't log in as root.

----------User----------------------Active--------------------Command
user@domain.net------------- Yes--------------/home/DomainFolder/homes/user/.usermin/mailbox/auto.pl

You could try and set up a new one and see if the entry gets added

Fri, 06/16/2017 - 19:00
amityweb

Yes I am logged in as root so I can see all cron jobs, and there are two referring to that file auto.pl but for other users. The user in question does not have that file nor has a cron job for it, even though I created auto-clearing for them :(

P.S. thanks for your very in depth explanation thats great!

Fri, 06/16/2017 - 19:24 (Reply to #5)
ksihota

If you make one and run it let me know if it works.

Kim

Edit: I just checked one of my accounts that did not have auto-clearing set up and the file does not exist. I assume it is created when the cronjob is created (when the initial auto-clearing event is created.) Either copy the file to the directory or try deleting the auto-clear event that you made originally and try creating a new one to see if the file gets created as well as the cron job.

Topic locked