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)
1.
cd
/srv/
2.
mkdir
filter
3.
vi
export
-filter.sh
Fill with the following line
01.
#!/bin/bash
02.
03.
clear
04.
05.
echo
"Retrieve zimbra user name..."
06.
07.
USERS=`
su
- zimbra -c 'zmprov -l gaa |
sort
'`;
08.
09.
for
ACCOUNT
in
$USERS;
do
10.
NAME=`
echo
$ACCOUNT`;
11.
filter=`
su
- zimbra -c
"zmprov ga $NAME zimbraMailSieveScript"
&
gt
; /tmp/$NAME`
12.
13.
sed
-i -e
"1d"
/tmp/$NAME
14.
sed
's/zimbraMailSieveScript: //g' /tmp/$NAME &
gt
; filter/$NAME
15.
rm
/tmp/$NAME
16.
echo
"Export filter for $NAME..."
17.
done
18.
echo
"All filter has been export successfully"
Save and execute the script
1.
chmod
+x /srv/
export
-filter.sh
2.
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
1.
cd
/srv/
2.
vi
import
-filter.sh
Fill with the following line
1.
for
file
in
/srv/filter/*
2.
do
3.
StrFilter=`
cat
"$file"
`
4.
Acc=`
echo
$
file
|
cut
-d
"/"
-f5`
5.
su
- zimbra -c
"zmprov ma $Acc zimbraMailSieveScript '$StrFilter'"
6.
echo
"Process filter $Acc"
7.
done
8.
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.