Importing from Mailbox to Zimbra UPLOAD_SIZE_LIMIT_EXCEEDED
Hey, have a problem here. Here is my script (very edited from an original):
Code:
#!/bin/bash
#
# Maildir to Zimbra import
#
# Created by Jaros.aw Czarniak on 26-10-2008
# Edited by Josh Henry 12-11-2009
#
function checktime {
date +%m-%d-%Y-%T
}
LOG=/var/log/mailimport/IMPORT-`checktime`.log
domain="3cis.biz" # change to your domain!
IMPORT="/Inbox"
clear
chown -R zimbra:zimbra *
for user in `ls -d1 */|sed s/\\\///`
do
echo "####USER####"|tee -a $LOG
echo "`checktime` - User $user"|tee -a $LOG
echo "####USER####"|tee -a $LOG
echo "#######"|tee -a $LOG
echo "# CUR #"|tee -a $LOG
echo "#######"|tee -a $LOG
for varDIR in `find $user -maxdepth 10 -type d -name cur| sed 's/ /_/g'`
do
###Removing .INBOX and turning '.'s into '/'s to import right into the inbox.
varCUT=`echo $varDIR|cut -f3 -d"/"|sed 's/.INBOX//; s/[.]//; s/[.]/\//g'`
varWC=`echo $varCUT |sed 's/\// /g'|wc -w` ###Counting the words in the line for diretory creation
varFIN=${varCUT/_/ }
echo |tee -a $LOG
echo "`checktime` - Directory with /cur - /Inbox/$varFIN"|tee -a $LOG
if [ "$varFIN" = "cur" ] ###If the folder is /Inbox then write directly to /Inbox.
then
echo "`checktime` - ##Starting mail Import for directory /Inbox##"|tee -a $LOG
/opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage "${IMPORT}" "$PWD/$user/Maildir/cur"|tee -a $LOG
echo "`checktime` - ##Mail Import complete for directory /Inbox##"|tee -a $LOG
elif [ $varCUT == "Sent" ] ###If the folder is the sent folder then write to /Sent
then
echo "`checktime` - ##Starting mail Import for directory /Sent##"|tee -a $LOG
/opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage "/Sent" "${PWD}/`echo $varDIR|sed 's/ /\\ /g; s/_/\\ /g'`"|tee -a $LOG
echo "`checktime` - ##Mail Import complete for directory /Sent##"|tee -a $LOG
elif [ $varCUT == "Drafts" ] ###If the folder is the drafts folder then write to /Drafts
then
echo "`checktime` - ##Starting mail Import for directory /Drafts##"|tee -a $LOG
/opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage "/Drafts" "${PWD}/`echo $varDIR|sed 's/ /\\ /g; s/_/\\ /g'`"|tee -a $LOG
echo "`checktime` - ##Mail Import complete for directory /Drafts##"|tee -a $LOG
elif [ $varCUT == "Trash" ] || [ $varCUT == "Junk" ] || [ $varCUT == "Deleted_Items" ] ###We don't want to waste time on these, bypassing
then
echo "`checktime` - ####BYPASSING because this folder is $varCUT and doesn't need to be transfered####"|tee -a $LOG
else
ii=2
for (( i = $varWC; i >= 0; i-- )) ##Loop through the dir's and create them in order
do
varSEQ=`seq -s, 1 $ii` ##Create a sequence for the cut command
varFOLDER=`echo ${IMPORT}/$varCUT|cut -f$varSEQ -d "/"|sed 's/_/ /g'` ##The actual folder to create
echo "`checktime` - Creating Folder - "$varFOLDER|tee -a $LOG
/opt/zimbra/bin/zmmailbox -z -m $user@$domain createFolder "$varFOLDER"|tee -a $LOG ##Creating the Folders.
echo >>$LOG
((ii++))
done
echo "`checktime` - ##Starting mail Import for directory "$varFOLDER"##"|tee -a $LOG
/opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage "$varFOLDER" "${PWD}/`echo $varDIR|sed 's/ /\\ /g; s/_/\\ /g'`"|tee -a $LOG
echo "`checktime` - ##Mail Import Complete for directory "$varFOLDER"##"|tee -a $LOG
fi
done
echo "#######"|tee -a $LOG
echo "# NEW #"|tee -a $LOG
echo "#######"|tee -a $LOG
for varDIR in `find $user -maxdepth 10 -type d -name new| sed 's/ /_/g'`
do
###Removing .INBOX and turning '.'s into '/'s to import right into the inbox.
varCUT=`echo $varDIR|cut -f3 -d"/"|sed 's/.INBOX//; s/[.]//; s/[.]/\//g'`
varWC=`echo $varCUT |sed 's/\// /g'|wc -w` ###Counting the words in the line for diretory creation
varFIN=${varCUT/_/ }
echo |tee -a $LOG
echo "`checktime` - Directory with /new /Inbox/$varFIN"|tee -a $LOG
if [ "$varFIN" = "new" ] ###If the folder is /Inbox then write directly to /Inbox.
then
echo "`checktime` - ##Starting mail Import for directory /Inbox##"|tee -a $LOG
/opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage "${IMPORT}" "$PWD/$user/Maildir/new"|tee -a $LOG
echo "`checktime` - ##Mail Import complete for directory /Inbox##"|tee -a $LOG
elif [ $varCUT == "Sent" ] ###If the folder is the sent folder then write to /Sent
then
echo "`checktime` - ##Starting mail Import for directory /Sent##"|tee -a $LOG
/opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage "/Sent" "${PWD}/`echo $varDIR|sed 's/ /\\ /g; s/_/\\ /g'`"|tee -a $LOG
echo "`checktime` - ##Mail Import complete for directory /Sent##"|tee -a $LOG
elif [ $varCUT == "Drafts" ] ###If the folder is the drafts folder then write to /Drafts
then
echo "`checktime` - ##Starting mail Import for directory /Drafts##"|tee -a $LOG
/opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage "/Drafts" "${PWD}/`echo $varDIR|sed 's/ /\\ /g; s/_/\\ /g'`"|tee -a $LOG
echo "`checktime` - ##Mail Import complete for directory /Drafts##"|tee -a $LOG
elif [ $varCUT == "Trash" ] || [ $varCUT == "Junk" ] || [ $varCUT == "Deleted_Items" ] ###We don't want to waste time on these, bypassing
then
echo "`checktime` - ####BYPASSING because this folder is $varCUT and doesn't need to be transfered####"|tee -a $LOG
else
ii=2
for (( i = $varWC; i >= 0; i-- )) ##Loop through the dir's and create them in order
do
varSEQ=`seq -s, 1 $ii` ##Create a sequence for the cut command
varFOLDER=`echo ${IMPORT}/$varCUT|cut -f$varSEQ -d "/"|sed 's/_/ /g'` ##The actual folder to create
echo "`checktime` - Creating Folder - "$varFOLDER|tee -a $LOG
/opt/zimbra/bin/zmmailbox -z -m $user@$domain createFolder "$varFOLDER"|tee -a $LOG ##Creating the Folders.
echo >>$LOG
((ii++))
done
echo "`checktime` - ##Starting mail Import for directory "$varFOLDER"##"|tee -a $LOG
/opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage "$varFOLDER" "${PWD}/`echo $varDIR|sed 's/ /\\ /g; s/_/\\ /g'`"|tee -a $LOG
echo "`checktime` - ##Mail Import Complete for directory "$varFOLDER"##"|tee -a $LOG
fi
done
done
It gets about 8800 messages into a mailbox then it kills the script with an error: "ERROR: zclient.UPLOAD_SIZE_LIMIT_EXCEEDED (upload size limit exceeded)"
The mailbox size is 25Meg so it's strange that would even be a problem. I've already imported over half the user's email twice (they've purged it for me) and I'm sure they are getting annoyed with having to do this. Has anyone else run into the size limit issue? Possibly importing too many messages?
thanks.