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.
Good luck and hopefully useful 😀
Hello Immanudin,
I receive following error while importing the filter.
Proses filter
usage: modifyAccount(ma) {name@domain|id} [attr1 value1 [attr2 value2…]]
For general help, type : zmprov –help
Proses filter
usage: modifyAccount(ma) {name@domain|id} [attr1 value1 [attr2 value2…]]
For general help, type : zmprov –help
Hi Pankaj Daga,
Could you please give me your sample script/file result of export? or you can use ZeXtras : http://zextras.com/ to export/import of all your data
same.
Process filter
usage: modifyAccount(ma) {name@domain|id} [attr1 value1 [attr2 value2…]]
For general help, type : zmprov –help
Process filter
usage: modifyAccount(ma) {name@domain|id} [attr1 value1 [attr2 value2…]]
For general help, type : zmprov –help
Process filter
usage: modifyAccount(ma) {name@domain|id} [attr1 value1 [attr2 value2…]]
For general help, type : zmprov –help
Hi Landi,
Could you please give me your sample script/file result of export? or you can use ZeXtras : http://zextras.com/ to export/import of all your data
sample of export file
require [“fileinto”, “reject”, “tag”, “flag”];
# sales
if anyof (address :all :is :comparator “i;ascii-casemap” [“from”] “sales@xyz.com”) {
fileinto “/sales/sales”;
stop;
}
# hod
if anyof (address :all :is :comparator “i;ascii-casemap” [“from”] “hod@xyx.com”) {
fileinto “SACHIN”;
stop;
}
my sample export
# nagios1
if allof (address :all :contains :comparator “i;ascii-casemap” [“from”] “nagios@dms.kenic.or.ke”) {
fileinto “Inbox/nagios”;
stop;
}
While importing we need to change this line
Acc=`echo $file | cut -d “/” -f5`
to
Acc=`echo $file | cut -d “/” -f4`
This will import your filter rules.