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.

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