HOWTO:ZIMBRA DELETE

Da Helpedia.

#!/bin/bash


#calulcate date 90 days ago
DATESTAMP=`date --utc +%s`

DATESTAMP90D=`expr $DATESTAMP - 7776000`
NINETYDAYS=`date -d @$DATESTAMP90D "+%m/%d/%Y"`
MAXRESULTS=200
ACCOUNTLIST=`zmprov gaa`
QUERY="before:($NINETYDAYS) under:inbox"
REGEX="[a-z0-9]*-[a-z0-9]*-[a-z0-9]*-[a-z0-9]*-[a-z0-9]*:[0-9]*"
for I in $ACCOUNTLIST
do
    echo "running $QUERY for account $I DELETING RESULTS !"
    MAILRESULT=`zmmboxsearch -m $I -q "$QUERY" -l $MAXRESULTS | grep
'[a-z0-9]*-[a-z0-9]*-[a-z0-9]*-[a-z0-9]*-[a-z0-9]*:[0-9]*' -o`

    # any work to do ?
    LEN=$(echo ${#MAILRESULT})

    while [ $LEN -gt 5 ]; do
        IDS=""
        for ID in $MAILRESULT
            do
            IDS=$IDS","$ID
            done
        IDS=`echo $IDS | cut -c2-`

        echo "deleting items..."
        echo "change zmmailbox command here !"
        #zmmailbox -z -m $I di $IDS


        # REPEAT QUERY
        MAILRESULT=`zmmboxsearch -m $I -q "$QUERY" -l $MAXRESULTS | grep
'[a-z0-9]*-[a-z0-9]*-[a-z0-9]*-[a-z0-9]*-[a-z0-9]*:[0-9]*' -o`
        LEN=$(echo ${#MAILRESULT})

    done

inoltre:

Admins can set these attributes on COS or individual user- The one's currently exposed in the admin console gui > cos/user > advanced tab: zimbraMailMessageLifetime (default is 0 disabled - careful with this one as it affects mail in any folder) zimbraMailSpamLifetime (default is 30d) zimbraMailTrashLifetime (default is 30d)

These as well, though currently not exposed in the user's UI: zimbraPrefInboxReadLifetime zimbraPrefInboxUnreadLifetime zimbraPrefSentLifetime zimbraPrefJunkLifetime zimbraPrefTrashLifetime

Strumenti personali
Namespace
Varianti
Azioni
Navigazione
Strumenti