Browse Source

mig zimbra

test
Sébastien Faton 2 years ago
parent
commit
3506061ef6
  1. 50
      zimbra/Migration/1_export_accounts.sh
  2. 56
      zimbra/Migration/2_import_accounts.sh

50
zimbra/Migration/1_export_accounts.sh

@ -0,0 +1,50 @@
#!/bin/bash
echo "Saisir le domaine :"
read DOM
cd domains
rm domains.txt
echo $DOM >> domains.txt
cd ..
echo
echo "Exportation des comptes :"
cd accounts
rm users.txt
zmprov -l gaa $DOM | tee -a users.txt
cd ..
echo
echo "Exportation des informations sur les comptes :"
cd account_details
rm -r *
for user in `cat ../accounts/users.txt`; do zmprov ga $user | grep -i Name: | tee -a $user.txt ; done
cd ..
echo
echo "Exportation des mots de passe :"
cd passwords
rm -r *
for user in `cat ../accounts/users.txt`; do zmprov -l ga $user userPassword | grep userPassword: | awk '{ print $2}' | tee -a $user.shadow; done
cd ..
echo
echo "Exportation des listes de diffusion :"
cd distribution_lists
rm -r *
zmprov gadl $DOM | tee -a distribution_lists.txt
for list in `cat distribution_lists.txt`; do zmprov gdlm $list > $list.txt ;echo "$list"; done
cd ..
echo
echo "Exportation des aliases :"
cd aliases
rm -r *
for user in `cat ../accounts/users.txt`; do zmprov ga $user | grep zimbraMailAlias | awk '{print $2}' | tee -a $user.txt ;echo $i ;done
cd ..
echo
echo "Fin de l'export des comptes !!!!!"
echo "Lancer le script 2_imports_accounts sur le nouveau serveur"

56
zimbra/Migration/2_import_accounts.sh

@ -0,0 +1,56 @@
#!/bin/bash
#echo "Importation du domaine :"
#cd domains
#for domain in `cat domains.txt `; do zmprov cd $domain zimbraAuthMech zimbra ;echo $domain ;done
#cd ..
#echo
echo "Importation des comptes :"
PASSWORDS="passwords"
ACCOUNT_DETAILS="account_details"
USERS="accounts/users.txt"
for i in `cat $USERS`
do
givenName=$(grep givenName: $ACCOUNT_DETAILS/$i.txt | cut -d ":" -f2)
displayName=$(grep displayName: $ACCOUNT_DETAILS/$i.txt | cut -d ":" -f2)
shadowpass=$(cat $PASSWORDS/$i.shadow)
zmprov ca $i "TeMpPa55^()" cn "$givenName" displayName "$displayName" givenName "$givenName"
zmprov ma $i userPassword "$shadowpass"
done
echo
echo "Importation des listes de diffusion :"
for lists in `cat distribution_lists/distribution_lists.txt`; do zmprov cdl $lists ; echo "$lists -- done " ; done
cd distribution_lists
for list in `cat distribution_lists.txt`
do
for mbmr in `grep -v '#' ./$list.txt | grep '@'`
do
zmprov adlm $list $mbmr
echo " $mbmr has been added to $list"
done
done
cd ..
echo
echo "Importation des aliases :"
cd aliases
for user in `cat ../accounts/users.txt`
do
echo $user
if [ -f "./$user.txt" ]; then
for alias in `grep '@' ./$user.txt`
do
zmprov aaa $user $alias
echo "$user ALIAS $alias - Restored"
done
fi
done
cd ..
echo
echo "Fin de l'importation !!!!"
echo "M)Mettre à jour la COS sur le nouveau serveur"
echo "2)Configuration du domaine vers le nouveau serveur"
echo "3)Lancer le script 3_exports_mailbox.sh sur l'ancien serveur"
Loading…
Cancel
Save