Created
September 26, 2012 21:52
-
-
Save rwjblue/3790858 to your computer and use it in GitHub Desktop.
List account and distribution list details in Zimbra
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
sudo su - zimbra | |
# list all accounts and print out account name and aliases | |
for i in `zmprov -l gaa` ; do zmprov ga $i zimbraMailAlias ; done | |
# list all distribution lists and any members and/or aliases | |
for i in `zmprov gadl` ; do zmprov gdl $i zimbraMailAlias zimbraMailForwardingAddress ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I am trying to migrate the aliases from an old server to a modern server, exporting the aliases has been easy, I have done it this way.
I create the entire mailing list of any zimbra domain
su zimbra
zmprov -l gaa >emails.txt
I get the list of the aliases of the email accounts this way
mkdir -p alias/
chown -R zimbra:zimbra alias/
su zimbra
for i in
cat emails.txt
; do zmprov ga $i | grep zimbraMailAlias |awk '{print $2}' > alias/$i.txt ;echo $i ;doneOnce I have the aliases for each email account, we proceed to delete the email files that do not have any aliases in this way from the list.
find alias/ -type f -empty | xargs -n1 rm -v
Now I upload the files obtained that are emails.txt and the directory of /alias to the destination server, and here is where I have the error, I have made a script to perform the upload but I think I'm doing it wrong, I do not know if it is for permissions or otherwise, the script is this.
#!/bin/bash
for i in
cat /opt/zimbra/migracion/emails.txt
do
if [ -f "alias/$i.txt" ]; then
for j in
grep '@' /opt/zimbra/migracion/alias/$i.txt
do
zmprov aaa $i $j
echo "$i HAS ALIAS $j --- Restored"
done
fi
done
Can you tell me what mistake I am making?
Greetings and thanks