From b7c3980d7861e4494401b6a882b63147ee5ed908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?s=C3=A9bastien?= Date: Tue, 6 Feb 2024 11:03:43 +0100 Subject: [PATCH] =?UTF-8?q?=09modifi=C3=A9=C2=A0:=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20zimbra/Migration/1=5Fexport=5Faccounts.sh=20=09modifi=C3=A9?= =?UTF-8?q?=C2=A0:=20=20=20=20=20=20=20=20=20zimbra/Migration/2=5Fimport?= =?UTF-8?q?=5Faccounts.sh=20=09modifi=C3=A9=C2=A0:=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20zimbra/Migration/5=5Fexports=5Ffilters=5Fand=5Fsig.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zimbra/Migration/1_export_accounts.sh | 32 +++++++++---------- zimbra/Migration/2_import_accounts.sh | 10 +++--- zimbra/Migration/5_exports_filters_and_sig.sh | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/zimbra/Migration/1_export_accounts.sh b/zimbra/Migration/1_export_accounts.sh index 1387578..97ad635 100644 --- a/zimbra/Migration/1_export_accounts.sh +++ b/zimbra/Migration/1_export_accounts.sh @@ -4,46 +4,46 @@ RCODE=$? echo "Saisir le domaine :" 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 cd .. echo 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 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 /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 .. 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 /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 .. echo 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 -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 .. 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 /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 .. echo diff --git a/zimbra/Migration/2_import_accounts.sh b/zimbra/Migration/2_import_accounts.sh index e477f86..9fe8f0f 100644 --- a/zimbra/Migration/2_import_accounts.sh +++ b/zimbra/Migration/2_import_accounts.sh @@ -4,7 +4,7 @@ RCODE=$? echo "Importation des comptes :" PASSWORDS="passwords" ACCOUNT_DETAILS="account_details" -USERS="accounts/users.txt" +USERS="/opt/zimbra/nfsbackup/migration/accounts/users.txt" for i in `cat $USERS` do givenName=$(grep givenName: $ACCOUNT_DETAILS/$i.txt | cut -d ":" -f2) @@ -16,8 +16,8 @@ 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 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` do for mbmr in `grep -v '#' ./$list.txt | grep '@'` @@ -30,8 +30,8 @@ cd .. echo 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 echo $user if [ -f "./$user.txt" ]; then diff --git a/zimbra/Migration/5_exports_filters_and_sig.sh b/zimbra/Migration/5_exports_filters_and_sig.sh index 4e4fd0c..4c32097 100644 --- a/zimbra/Migration/5_exports_filters_and_sig.sh +++ b/zimbra/Migration/5_exports_filters_and_sig.sh @@ -12,7 +12,7 @@ RCODE=$? 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 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 echo "erreur dans l'export des Signatures'" exit 1;