Browse Source

modifié : zimbra/Migration/1_export_accounts.sh

modifié :         zimbra/Migration/2_import_accounts.sh
	modifié :         zimbra/Migration/5_exports_filters_and_sig.sh
master
Sébastien Faton 11 months ago
parent
commit
b7c3980d78
  1. 32
      zimbra/Migration/1_export_accounts.sh
  2. 10
      zimbra/Migration/2_import_accounts.sh
  3. 2
      zimbra/Migration/5_exports_filters_and_sig.sh

32
zimbra/Migration/1_export_accounts.sh

@ -4,46 +4,46 @@ RCODE=$?
echo "Saisir le domaine :" echo "Saisir le domaine :"
read DOM read DOM
cd domains
rm domains.txt
cd /opt/zimbra/nfsbackup/migration/domains
rm /opt/zimbra/nfsbackup/migration/domains/domains.txt
echo $DOM >> domains.txt echo $DOM >> domains.txt
cd .. cd ..
echo echo
echo "Exportation des comptes :" echo "Exportation des comptes :"
cd accounts
rm users.txt
cd /opt/zimbra/nfsbackup/migration/accounts
rm /opt/zimbra/nfsbackup/migration/accounts/users.txt
zmprov -l gaa $DOM | tee -a users.txt zmprov -l gaa $DOM | tee -a users.txt
cd .. cd ..
echo echo
echo "Exportation des informations sur les comptes :" 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 /opt/zimbra/nfsbackup/migration/account_details/
rm /opt/zimbra/nfsbackup/migration/account_details/*
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do zmprov ga $user | grep -i Name: | tee -a $user.txt ; done
cd .. cd ..
echo echo
echo "Exportation des mots de passe :" 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 /opt/zimbra/nfsbackup/migration/passwords
rm /opt/zimbra/nfsbackup/migration/passwords/*
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do zmprov -l ga $user userPassword | grep userPassword: | awk '{ print $2}' | tee -a $user.shadow; done
cd .. cd ..
echo echo
echo "Exportation des listes de diffusion :" echo "Exportation des listes de diffusion :"
cd distribution_lists
rm -r *
cd /opt/zimbra/nfsbackup/migration/distribution_lists
rm /opt/zimbra/nfsbackup/migration/distribution_lists/*
zmprov gadl $DOM | tee -a distribution_lists.txt zmprov gadl $DOM | tee -a distribution_lists.txt
for list in `cat distribution_lists.txt`; do zmprov gdlm $list > $list.txt ;echo "$list"; done
for list in `cat /opt/zimbra/nfsbackup/migration/distribution_lists/distribution_lists.txt`; do zmprov gdlm $list > $list.txt ;echo "$list"; done
cd .. cd ..
echo echo
echo "Exportation des aliases :" 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 /opt/zimbra/nfsbackup/migration/aliases
rm /opt/zimbra/nfsbackup/migration/aliases/*
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do zmprov ga $user | grep zimbraMailAlias | awk '{print $2}' | tee -a $user.txt ;echo $i ;done
cd .. cd ..
echo echo

10
zimbra/Migration/2_import_accounts.sh

@ -4,7 +4,7 @@ RCODE=$?
echo "Importation des comptes :" echo "Importation des comptes :"
PASSWORDS="passwords" PASSWORDS="passwords"
ACCOUNT_DETAILS="account_details" ACCOUNT_DETAILS="account_details"
USERS="accounts/users.txt"
USERS="/opt/zimbra/nfsbackup/migration/accounts/users.txt"
for i in `cat $USERS` for i in `cat $USERS`
do do
givenName=$(grep givenName: $ACCOUNT_DETAILS/$i.txt | cut -d ":" -f2) givenName=$(grep givenName: $ACCOUNT_DETAILS/$i.txt | cut -d ":" -f2)
@ -16,8 +16,8 @@ done
echo echo
echo "Importation des listes de diffusion :" 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 lists in `cat /opt/zimbra/nfsbackup/migration/distribution_lists/distribution_lists.txt`; do zmprov cdl $lists ; echo "$lists -- done " ; done
cd /opt/zimbra/nfsbackup/migration/distribution_lists
for list in `cat distribution_lists.txt` for list in `cat distribution_lists.txt`
do do
for mbmr in `grep -v '#' ./$list.txt | grep '@'` for mbmr in `grep -v '#' ./$list.txt | grep '@'`
@ -30,8 +30,8 @@ cd ..
echo echo
echo "Importation des aliases :" echo "Importation des aliases :"
cd aliases
for user in `cat ../accounts/users.txt`
cd /opt/zimbra/nfsbackup/migration/aliases
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`
do do
echo $user echo $user
if [ -f "./$user.txt" ]; then if [ -f "./$user.txt" ]; then

2
zimbra/Migration/5_exports_filters_and_sig.sh

@ -12,7 +12,7 @@ RCODE=$?
echo "Export des signatures" echo "Export des signatures"
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do echo "Exporting Default Signature : $user" ; zmprov ga $user zimbraPrefMailSignatureHTML > sig/$user-sig.txt ;done for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do echo "Exporting Default Signature : $user" ; zmprov ga $user zimbraPrefMailSignatureHTML > sig/$user-sig.txt ;done
sed -i -e "1d" /opt/zimbra/nfsbackup/migration/sig/* sed -i -e "1d" /opt/zimbra/nfsbackup/migration/sig/*
sed -i -e 's/zimbraMailSieveScript: //g' /opt/zimbra/nfsbackup/migration/sig/*
sed -i -e 's/zimbraPrefMailSignatureHTML: //g' /opt/zimbra/nfsbackup/migration/sig/*
if [ $RCODE -eq 1 ]; then if [ $RCODE -eq 1 ]; then
echo "erreur dans l'export des Signatures'" echo "erreur dans l'export des Signatures'"
exit 1; exit 1;

Loading…
Cancel
Save