Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Auto-Purging

  1. #11
    dkarp is offline Zimbra Employee
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    11

    Default

    Quote Originally Posted by tbenoit View Post
    It's not very efficient as each "deleteMessage" command takes about 1 second, so deleting 1000 messages will take a bit of time. It's also a server-side "pig" in resources, bringing a basically idle server (just 1 domain and 1 test email account) to high CPU & I/O utilization. The server I'm testing on isn't a "beast" but it's no slouch either (Intel Conroe 3060 Dual Core, 4GB RAM, 4 x 146GB SAS HDD in RAID-10).
    Note that you can put >1 message ID in a single zmmailbox deleteMessage call -- just space-delimit them.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  2. #12
    dkarp is offline Zimbra Employee
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    11

    Default

    Quote Originally Posted by tbenoit View Post
    We're evaluating the Network Edition for a possible migration to it.

    One thing we have the need for is per-folder message aging. I know such a thing doesn't exist in Zimbra, but there is a BugID on it (I did vote for it, but it only has 4 Votes). But, to get around that we can search for messages and delete them. My main concern is one specific folder that receives thousands of emails daily (status emails for servers, jobs, etc). After 4-6 weeks, we'll have hundreds of thousands of emails in that one folder. We'd like to clean it out after 6 weeks, but manually deleting them after a search isn't a real option as there will be thousands of emails to delete.

    Anyone has any ideas of how to better automate the deleting of emails from a folder using the current release version of Zimbra?
    Would Bug 13435 - User-definable expiration policy for systems folders (fixed in 5.0) solve your problem?
    Bugzilla - Wiki - Downloads - Before posting... Search!

  3. #13
    Krishopper is offline Dedicated Member
    Join Date
    Dec 2006
    Location
    Minneapolis MN
    Posts
    777
    Rep Power
    9

    Default

    Quote Originally Posted by tbenoit View Post
    [url=http://bugzilla.zimbra.com/show_bug.cgi?id=6542]
    It's not very efficient as each "deleteMessage" command takes about 1 second, so deleting 1000 messages will take a bit of time. It's also a server-side "pig" in resources, bringing a basically idle server (just 1 domain and 1 test email account) to high CPU & I/O utilization. The server I'm testing on isn't a "beast" but it's no slouch either (Intel Conroe 3060 Dual Core, 4GB RAM, 4 x 146GB SAS HDD in RAID-10).
    One thing that might make it more efficient is to create a temporary file with all of the "deleteMessage $i" lines in it within the loop

    Code:
    for i in `zmmailbox -z -m $THEACCOUNT search -l 1000 "in:$THEFOLDER (before:$THEDATE)" | grep "\. -" | cut -f2 -d"-" | cut -f1 -d" "`
      do
        echo "deleteMessage $i" >> /tmp/deletecommands.txt
      done
    and then outside of the loop execute

    Code:
    zmmailbox -z -m $THEACCOUNT < /tmp/deletecommands.txt
    or whatever.. that way you're only firing up the instance of Java once on the machine and letting it delete them all in one run.. I've done that with folders before and it worked MUCH better.

  4. #14
    Krishopper is offline Dedicated Member
    Join Date
    Dec 2006
    Location
    Minneapolis MN
    Posts
    777
    Rep Power
    9

    Default

    Shoot. Should have read page 2.. looks like someone already mentioned something similar to this

  5. #15
    jerelabs is offline Active Member
    Join Date
    Jul 2007
    Posts
    30
    Rep Power
    8

    Default

    Quote Originally Posted by dkarp View Post
    "Virtual" conversations wrapping a single message. They're not actually persisted in the database.
    Alright, well I'm confused by what is going on with my system. I have a filter rule to keep certain messages in the inbox then copy them to a Ham folder (which I run a trainsa cron job against). I'd like to have something similar to auto purge since they serve no use after training.

    Some of the messages in this Ham folder are tagged as virtual conversations and not regular messages Why would this happen? How do I find the message ID of just the copy of the message in the Ham folder?

    Will deleteConversation accomplish this, or will it also remove copies of the message in other folders?

  6. #16
    dkarp is offline Zimbra Employee
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    11

    Default

    When you do a search, make sure to request that it return messages instead of conversations.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  7. #17
    americo is offline Active Member
    Join Date
    Mar 2006
    Posts
    26
    Rep Power
    9

    Default Auto-Purging Messages & Conversations

    The next code will delete 30 days old messages and conversations only in the folder Inbox. You can use this script with cron to run periodically.

    Code:
    #!/bin/bash
    #
    #
    
    zmprov gaa > /tmp/acccountsList.txt
    
    for acct in `cat /tmp/acccountsList.txt` ; do
    
    THEACCOUNT=$acct
    THEDATE=$(date --date='30 days ago' +%m/%d/%y)
    THEFOLDER="/Inbox"
    
    # (before:$THEDATE)
    touch /tmp/deleteOldMessagesList.txt
    for i in `zmmailbox -z -m $THEACCOUNT search -l 1000 "in:$THEFOLDER (before:$THEDATE)" | grep conv | sed -e "s/^\s\s*//" | sed -e "s/\s\s*/ /g" | cut -d" " -f2`
      do
      	if [[ $i =~ [-]{1} ]]
    	then
        	    MESSAGEID=${i#-}
    	    echo "deleteMessage $MESSAGEID" >> /tmp/deleteOldMessagesList.txt
    	else
    	    echo "deleteConversation $i" >> /tmp/deleteOldMessagesList.txt
    	fi
      done
    
      zmmailbox -z -m $THEACCOUNT < /tmp/deleteOldMessagesList.txt >> /opt/tsystems-tools/purgeMail/process.log
      rm -f /tmp/deleteOldMessagesList.txt
    
    done
    rm -f /tmp/acccountsList.txt
    Last edited by americo; 05-09-2008 at 02:36 PM.

  8. #18
    mmorse's Avatar
    mmorse is offline Moderator
    Join Date
    May 2006
    Location
    USA
    Posts
    6,242
    Rep Power
    21

    Default

    Seeing as you're dealing with the inbox; if you're on a more recent 5.0.x build though currently not exposed in the user's UI you can apply the below to COS or individual user:
    zmprov mc cosName zimbraPrefInboxReadLifetime 30d
    zmprov mc default zimbraPrefInboxUnreadLifetime 30d

  9. #19
    americo is offline Active Member
    Join Date
    Mar 2006
    Posts
    26
    Rep Power
    9

    Default

    mmm.. i try with some settings like that... but doesn't work... i have zimbra open source 5.0.1

  10. #20
    mmorse's Avatar
    mmorse is offline Moderator
    Join Date
    May 2006
    Location
    USA
    Posts
    6,242
    Rep Power
    21

    Default

    5.0.5 is the current version.

Page 2 of 3 FirstFirst 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 07-31-2007, 11:17 PM
  2. Auto timezone problem in calendar
    By kdunphy in forum Administrators
    Replies: 8
    Last Post: 03-19-2007, 05:54 PM
  3. zimbra 4.5RC2 pop accounts auto check???
    By nfear24 in forum Administrators
    Replies: 5
    Last Post: 01-30-2007, 01:25 PM
  4. Email Address Auto complete
    By mcavalieri in forum Users
    Replies: 5
    Last Post: 07-10-2006, 02:08 PM
  5. Email auto complete in 3.1 ?
    By sperkins in forum Administrators
    Replies: 2
    Last Post: 04-29-2006, 05:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •