You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #!/bin/bash
  2. RCODE=$?
  3. if [ ! whoami = "zimbra" ]; then
  4. echo "Le user doit être zimbra, pas root ! "
  5. exit 1;
  6. fi
  7. echo "Saisir le domaine :"
  8. read DOM
  9. cd /opt/zimbra/nfsbackup/migration/domains
  10. rm /opt/zimbra/nfsbackup/migration/domains/domains.txt
  11. echo $DOM >> domains.txt
  12. cd ..
  13. echo
  14. echo "Exportation des comptes :"
  15. cd /opt/zimbra/nfsbackup/migration/accounts
  16. rm /opt/zimbra/nfsbackup/migration/accounts/users.txt
  17. zmprov -l gaa $DOM | tee -a users.txt
  18. cd ..
  19. echo
  20. echo "Exportation des informations sur les comptes :"
  21. cd /opt/zimbra/nfsbackup/migration/account_details/
  22. rm /opt/zimbra/nfsbackup/migration/account_details/*
  23. for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`; do zmprov ga $user | grep -i Name: | tee -a $user.txt ; done
  24. cd ..
  25. echo
  26. echo "Exportation des mots de passe :"
  27. cd /opt/zimbra/nfsbackup/migration/passwords
  28. rm /opt/zimbra/nfsbackup/migration/passwords/*
  29. 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
  30. cd ..
  31. echo
  32. echo "Exportation des listes de diffusion :"
  33. cd /opt/zimbra/nfsbackup/migration/distribution_lists
  34. rm /opt/zimbra/nfsbackup/migration/distribution_lists/*
  35. zmprov gadl $DOM | tee -a distribution_lists.txt
  36. for list in `cat /opt/zimbra/nfsbackup/migration/distribution_lists/distribution_lists.txt`; do zmprov gdlm $list > $list.txt ;echo "$list"; done
  37. cd ..
  38. echo
  39. echo "Exportation des aliases :"
  40. cd /opt/zimbra/nfsbackup/migration/aliases
  41. rm /opt/zimbra/nfsbackup/migration/aliases/*
  42. 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
  43. cd ..
  44. echo
  45. if [ $RCODE -eq 1 ]; then
  46. echo "erreur dans l'export'"
  47. exit 1;
  48. fi
  49. if [ $RCODE -eq 0 ]; then
  50. echo "export terminée !!!!"
  51. echo "lancer l'import sur le serveur Dest"
  52. exit;
  53. fi