Browse Source

nouveau fichier : zimbra/Migration/3_exports_final.sh

modifié :         zimbra/Migration/3_exports_mailbox.sh
	nouveau fichier : zimbra/Migration/4_imports_mailboxes.sh
	supprimé :        zimbra/Migration/5_export_filtres.sh
	supprimé :        zimbra/Migration/6_import_filtres.sh
master
Sébastien Faton 12 months ago
parent
commit
e155b851d8
  1. 19
      zimbra/Migration/3_exports_final.sh
  2. 6
      zimbra/Migration/3_exports_mailbox.sh
  3. 35
      zimbra/Migration/4_imports_mailboxes.sh
  4. 5
      zimbra/Migration/5_export_filtres.sh
  5. 0
      zimbra/Migration/6_import_filtres.sh

19
zimbra/Migration/3_exports_final.sh

@ -0,0 +1,19 @@
#!/bin/bash
RCODE=$?
echo "Export mailboxes :"
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`;
do
echo "Exporting mailbox $user"; zmmailbox -z -t 0 -m $user getRestURL --startTime $(date -d '-3 day' +%Y/%m/%d) --endTime $(date -d '+1 day' +%Y/%m/%d) -u "https://127.0.0.1:7071" "//?fmt=tgz&resolve=modify" > /opt/zimbra/nfsbackup/migration/archives/$user.tgz ;
done
if [ $RCODE -eq 1 ]; then
echo "erreur dans l'export'"
exit 1;
fi
if [ $RCODE -eq 0 ]; then
echo "export terminée !!!!"
echo "Passez à l'import des datas sur serveur dest"
exit;
fi

6
zimbra/Migration/3_exports_mailbox.sh

@ -4,7 +4,7 @@ RCODE=$?
echo "Export mailboxes :" echo "Export mailboxes :"
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`;
do do
echo "Exporting mailbox $user" ;zmmailbox -z -t 0 -m $user getRestURL -u "https://127.0.0.1:7071" "//?fmt=tgz" > /opt/zimbra/nfsbackup/migration/archives/$user.tgz ;
echo "Exporting mailbox : $user" ;zmmailbox -z -t 0 -m $user getRestURL -u "https://127.0.0.1:7071" "//?fmt=tgz" > /opt/zimbra/nfsbackup/migration/archives/$user.tgz ;
done done
if [ $RCODE -eq 1 ]; then if [ $RCODE -eq 1 ]; then
@ -14,7 +14,7 @@ fi
if [ $RCODE -eq 0 ]; then if [ $RCODE -eq 0 ]; then
echo "Export des Filtres" echo "Export des Filtres"
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do zmprov ga $user zimbraMailSieveScript > filters/$user-filters.txt ;done
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do echo "Exporting Filters : $user" ; zmprov ga $user zimbraMailSieveScript > filters/$user-filters.txt ;done
sed -i -e "1d" /opt/zimbra/nfsbackup/migration/filters/* sed -i -e "1d" /opt/zimbra/nfsbackup/migration/filters/*
sed -i -e 's/zimbraMailSieveScript: //g' /opt/zimbra/nfsbackup/migration/filters/* sed -i -e 's/zimbraMailSieveScript: //g' /opt/zimbra/nfsbackup/migration/filters/*
if [ $RCODE -eq 1 ]; then if [ $RCODE -eq 1 ]; then
@ -23,7 +23,7 @@ if [ $RCODE -eq 0 ]; then
fi fi
if [ $RCODE -eq 0 ]; then if [ $RCODE -eq 0 ]; then
echo "Export des signatures" echo "Export des signatures"
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do 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/zimbraMailSieveScript: //g' /opt/zimbra/nfsbackup/migration/sig/*
if [ $RCODE -eq 1 ]; then if [ $RCODE -eq 1 ]; then

35
zimbra/Migration/4_imports_mailboxes.sh

@ -0,0 +1,35 @@
#!/bin/bash
RCODE=$?
for mailbox in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`;
do
zmmailbox -z -t 0 -m $mailbox postRestURL -u "https://127.0.0.1:7071" "//?fmt=tgz&resolve=modify" ./$mailbox.tgz ; echo "$mailbox - done ";
done
if [ $RCODE -eq 1 ]; then
echo "erreur dans l'import'"
exit 1;
fi
if [ $RCODE -eq 0 ]; then
echo "Import des Filtres"
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do echo "Importation des filtres : $user"; zmprov ma $user zimbraMailSieveScript "`cat /opt/zimbra/nfsbackup/migration/filters/$user-filters.txt`";done
if [ $RCODE -eq 1 ]; then
echo "erreur dans l'import des filtres'"
exit 1;
fi
if [ $RCODE -eq 0 ]; then
echo "Import des signatures"
for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do echo "Import des signatures: $user"; zmprov csig $user default zimbraPrefMailSignatureHTML "`cat /opt/zimbra/nfsbackup/migration/sig/$user-sig.txt`";done
if [ $RCODE -eq 1 ]; then
if [ $RCODE -eq 1 ]; then
echo "erreur dans l'import des Signatures'"
exit 1;
fi
if [ $RCODE -eq 0 ]; then
echo "Import terminée'"
exit;
fi
fi
fi

5
zimbra/Migration/5_export_filtres.sh

@ -1,5 +0,0 @@
#!/bin/bash
cd
for user in `cat ../accounts/users.txt`; do zmprov ga $user | grep zimbraMailSieveScript | awk '{print $2}' | tee -a $user.txt ;echo $i ;done

0
zimbra/Migration/6_import_filtres.sh

Loading…
Cancel
Save