Community Forum

Krusher
Krusher
Offline
Resolved
0 votes
I'm looking at an older posting here:
http://www.clearfoundation.com/component/option,com_kunena/Itemid,232/catid,14/func,view/id,54041/

...because I noticed back when we had used imap a lot (before going to POP3 and just downloading the emails off the server on the respective PC) that there are some users with some pretty large email folders in /var/spool/imap that should no longer be there. I've never used imap on my account, and my folder just has 4 cyrus.* files in it. I still use imap on my iPod for example and those emails get cleared out nicely once I start up the PC.

All of the emails are safe on the respective computer, so I followed the instructions above and logged in fine as root. I figured that I could just 'dm/cm' to the correct user/username mailbox, but it tells me 'permission denied' as root. Per the link above, I also checked /etc/clearos/imap.d/authorize (Peter's post #54099) and root is there. Editing /etc/pam.d/imap was done as well and I restarted the service.

Is there a better way to refresh (clean out) this imap folder than what I'm doing? If I delete the user folder or try and trick it by 'touch'ing new files with the same username and permissions, that doesn't work either.

P.S. My plan was to open up the email quickly on the POP3 PC so it downloads the emails off the server and then refresh the imap user folder.

Thanks
In Mail
Thursday, February 12 2015, 04:45 AM
Share this post:
Responses (7)
  • Accepted Answer

    Thursday, June 01 2017, 03:14 PM - #Permalink
    Resolved
    0 votes
    This is an old thread but I found a different approach to the solution which I will share:

    The cyrus.conf file allows similar approach to cron job to be executed within it configuration file by using:
    EVENTS {
    # this is required
    checkpoint cmd="ctl_cyrusdb -c" period=30

    # this is only necessary if using duplicate delivery suppression
    delprune cmd="ctl_deliver -E 3" period=1440

    # this is only necessary if caching TLS sessions
    tlsprune cmd="tls_prune" period=1440

    # deletes all the users mailboxes messages for the Spam folder.
    spamPurge cmd="ipurge -s -X -f -d 62 user/*/Spam" at=0100

    # example: deletes all the users mailboxes messages for the Trash folder.
    # trashPurge cmd="ipurge -s -X -f -d 365 user/*/Trash" at=0200
    }


    ipurge seem to do the trick for me. Note: imapd.conf unixhierarchysep is enabled, the delimiter used is '/' instead of '.'
    The reply is currently minimized Show
  • Accepted Answer

    Krusher
    Krusher
    Offline
    Tuesday, February 17 2015, 01:48 AM - #Permalink
    Resolved
    0 votes
    Thanks, I'll give this another look maybe tomorrow or Wednesday. We've been out of power here now for a little over an hour, and my Internet will eventually give up even if the batteries make it.

    Anyway, for the POP setup we have use, the PC downloads the emails from the server and then deletes them. If someone uses a smart phone or tablet, that uses IMAP and the email stays on the server until the PC gets to download it.

    It may come down to researching this a bit more as you've said; I'll experiment more when the countdown clock isn't ticking. :)
    The reply is currently minimized Show
  • Accepted Answer

    Monday, February 16 2015, 09:36 AM - #Permalink
    Resolved
    0 votes
    My change to cyrus.conf is an addition to the end:
    EVENTS {
    # this is required
    checkpoint cmd="ctl_cyrusdb -c" period=30

    # this is only necessary if using duplicate delivery suppression
    delprune cmd="ctl_deliver -E 3" period=1440

    # this is only necessary if caching TLS sessions
    tlsprune cmd="tls_prune" period=1440

    delprune cmd="cyr_expire -E 1 -X 7" at=0001
    }
    rather than a change.

    Looking through my logs I see events at 00:01 which seem to do a lot of purging. I also see some at 03.?? (which is cron.daily) also purging a bit so they are both doing some work.

    Try them both. They won't harm, but I would have thought running cyr_expire manually would have done something if either of these are going to work. You may need to research a bit more as I use IMAP and not POP so I don't know if POP behaves differently. Is the POP client set up to Delete from Server or just Mark as Read but only download Unread messages?

    On my client I (Thunderbird) also have the option to trigger an expunge when exiting which I have set.
    The reply is currently minimized Show
  • Accepted Answer

    Krusher
    Krusher
    Offline
    Monday, February 16 2015, 03:59 AM - #Permalink
    Resolved
    0 votes
    Ok, just to see what would happen with cyr_expire I tried your first command manually:


    ./cyr_expire -E 1s -X 1s


    And it ran fine, but didn't seem to give any additional space back in the 'df' command. In /etc/cyrus.conf, here's the default EVENTS subroutine:


    EVENTS {
    # this is required
    checkpoint cmd="ctl_cyrusdb -c" period=30

    # this is only necessary if using duplicate delivery suppression
    delprune cmd="ctl_deliver -E 3" period=1440

    # this is only necessary if caching TLS sessions
    tlsprune cmd="tls_prune" period=1440
    }


    ...so by default, delprune is set to run "ctl_deliver" instead of "cyr_expire" apparently.

    Do you think i should just try your /etc/impad.conf addition, /etc/cron.daily addition, and modify (comment out the old) delprune command in /etc/cyrus.conf to see if this changes anything? Or, should running cyr_expire manually have done something to free up space if it were going to?

    Thanks!
    The reply is currently minimized Show
  • Accepted Answer

    Krusher
    Krusher
    Offline
    Friday, February 13 2015, 03:43 AM - #Permalink
    Resolved
    0 votes
    Hi Nick and thanks for the two posts; I've been busy tonight and haven't had a chance to look at your suggestions in depth yet. I'll undo what I did yesterday from the older post and will look into your commands tomorrow. I had the same feeling that there must be a 'expunging' type command to clean things up and when I didn't find anything, went with the remove and replace the mailbox idea. I'll reply back here what happens afterwards.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, February 12 2015, 06:34 PM - #Permalink
    Resolved
    0 votes
    At home now. It looks like I have added:
    expire-days:	1
    expunge-days: 1
    to the end of /etc/imapd.conf.

    Also in my daily backup mail script which runs in /etc/cron.daily, I've added:
    # Expunge mailboxes
    /usr/lib/cyrus-imapd/cyr_expire -E 1s -X 1s


    Lastly in /etc/cyrus.conf in the EVENTS subroutine I have:
      delprune  cmd="cyr_expire -E 1 -X 7" at=0001
    I don't know if this was added by me or not.

    Between them they seem to keep things under control. I have a feeling it is the cron job which is doing the work.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, February 12 2015, 01:02 PM - #Permalink
    Resolved
    0 votes
    You should not need the older post as that issue was fixed a while ago and no edt of /etc/pam.d/imap should be needed. The problem is in cyradm and google will be your friend here. Start with this link and note what it says about the dm command and setaclmailbox. From memory, that is the start and there is one other access right you may need but it is a long time since I tried deleting a user so I can't remember exactly what I did.

    One issue I had with Cyrus is that it was not expunging deleted e-mails. have a look at the cyr_expire command. Also look at the delprune command. I'll have to have a look at what I did when I get home. I think I've put one in a nightly script and the other in imapd.conf as "belt and braces"

    I have a feeling you'll want to try expunging messages rather than delete and recreate the mailboxes.
    The reply is currently minimized Show
Your Reply