Wednesday, March 3, 2010

Distribution lists in Zimbra

Collect the Distribution lists/groups from your zimbra server to a file.

---------------------------------------------------------------------
#!/bin/bash
#Declare name of output file in the variable below:
file=dscripttest;
echo "" > $file;
for line in `zmprov gadl`
do
name=$line;
zmprov gdl $line|grep 'zimbraMailForwardingAddress:' > /tmp/tmp2.txt;
sed 's/zimbraMailForwardingAddress://g' /tmp/tmp2.txt > /tmp/tmp.txt;
dlists='';
for line1 in `cat /tmp/tmp.txt`;
do
dlists=$line1','$dlists;
done
echo $dlists;
echo $name':'$dlists >> $file;
sed -i '/^$/d' $file;
echo "">/tmp/tmp2.txt;
echo "">/tmp/tmp.txt;
done

No comments:

Post a Comment