Created
October 19, 2011 08:53
-
-
Save mankuthimma/1297767 to your computer and use it in GitHub Desktop.
Shell script to sync all users in a zimbra domain to an org wide distribution list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CURALL=`tempfile` | |
EMALL=`tempfile` | |
DIFFY=`tempfile` | |
ADDLIST=`tempfile` | |
zmprov -l gaa | sort | uniq > $EMALL | |
zmprov gdl all@example.com|grep "zimbraMailForwardingAddress:"|sed "s/zimbraMailForwardingAddress: //"|sort|uniq > $CURALL | |
diff --left-column $CURALL $EMALL | grep example.com | sed "s/> //g" > $DIFFY | |
diff /opt/zimbra/conf/all_list_ignore $DIFFY|grep example.com|sed "s/<//g"|sed "s/>//g"|sed "s/ //g" > $ADDLIST | |
echo "Adding members to all list" | |
cat $ADDLIST | |
while read l | |
do | |
zmprov adlm all@example.com $l | |
done < $ADDLIST | |
rm $EMALL $CURALL $DIFFY $ADDLIST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment