How To Export/Import Filter on Zimbra Mail Server
Filter is one of many attribute that should be migrate from old Zimbra to the new Zimbra. After previously success migrating Signature from old to the new Zimbra, this is what i do for migrating filter from old to the new Zimbra.
Export (on the old Zimbra)
cd /srv/
mkdir filter
vi export-filter.sh
Fill with the following line
#!/bin/bash
clear
echo "Retrieve zimbra user name..."
USERS=`su - zimbra -c 'zmprov -l gaa | sort'`;
for ACCOUNT in $USERS; do
NAME=`echo $ACCOUNT`;
filter=`su - zimbra -c "zmprov ga $NAME zimbraMailSieveScript" > /tmp/$NAME`
sed -i -e "1d" /tmp/$NAME
sed 's/zimbraMailSieveScript: //g' /tmp/$NAME > filter/$NAME
rm /tmp/$NAME
echo "Export filter for $NAME..."
done
echo "All filter has been export successfully"
Save and execute the script
chmod +x /srv/export-filter.sh
sh /srv/export-filter.sh
results of the above script are all file which is located in /srv/filter folder. Copy filter folder (and all files) to the new Zimbra
Import (on the new Zimbra)
Assuming filter folder (from old Zimbra) is placed in /srv/ folder. Make a script for import filter
cd /srv/
vi import-filter.sh
Fill with the following line
for file in /srv/filter/*
do
StrFilter=`cat "$file"`
Acc=`echo $file | cut -d "/" -f5`
su - zimbra -c "zmprov ma $Acc zimbraMailSieveScript '$StrFilter'"
echo "Process filter $Acc"
done
echo "All filter has been import successfully"
Please wait script until done and check either account who has filter.
Export (on the old Zimbra)
cd /srv/
mkdir filter
vi export-filter.sh
Fill with the following line
#!/bin/bash
clear
echo "Retrieve zimbra user name..."
USERS=`su - zimbra -c 'zmprov -l gaa | sort'`;
for ACCOUNT in $USERS; do
NAME=`echo $ACCOUNT`;
filter=`su - zimbra -c "zmprov ga $NAME zimbraMailSieveScript" > /tmp/$NAME`
sed -i -e "1d" /tmp/$NAME
sed 's/zimbraMailSieveScript: //g' /tmp/$NAME > filter/$NAME
rm /tmp/$NAME
echo "Export filter for $NAME..."
done
echo "All filter has been export successfully"
Save and execute the script
chmod +x /srv/export-filter.sh
sh /srv/export-filter.sh
results of the above script are all file which is located in /srv/filter folder. Copy filter folder (and all files) to the new Zimbra
Import (on the new Zimbra)
Assuming filter folder (from old Zimbra) is placed in /srv/ folder. Make a script for import filter
cd /srv/
vi import-filter.sh
Fill with the following line
for file in /srv/filter/*
do
StrFilter=`cat "$file"`
Acc=`echo $file | cut -d "/" -f5`
su - zimbra -c "zmprov ma $Acc zimbraMailSieveScript '$StrFilter'"
echo "Process filter $Acc"
done
echo "All filter has been import successfully"
Please wait script until done and check either account who has filter.
Comments
Post a Comment