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.

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