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.

64 lines
1.6 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #!/bin/bash
  2. RCODE=$?
  3. if [ $(id -u) -eq 0 ]
  4. then
  5. echo "Ce script ne doit pas être lancé en tant que root"
  6. exit 1
  7. fi
  8. echo "Importation des comptes :"
  9. PASSWORDS="passwords"
  10. ACCOUNT_DETAILS="account_details"
  11. USERS="/opt/zimbra/nfsbackup/migration/accounts/users.txt"
  12. for i in `cat $USERS`
  13. do
  14. givenName=$(grep givenName: $ACCOUNT_DETAILS/$i.txt | cut -d ":" -f2)
  15. displayName=$(grep displayName: $ACCOUNT_DETAILS/$i.txt | cut -d ":" -f2)
  16. shadowpass=$(cat $PASSWORDS/$i.shadow)
  17. zmprov ca $i "TeMpPa55^()" cn "$givenName" displayName "$displayName" givenName "$givenName"
  18. zmprov ma $i userPassword "$shadowpass"
  19. done
  20. echo
  21. echo "Importation des listes de diffusion :"
  22. for lists in `cat /opt/zimbra/nfsbackup/migration/distribution_lists/distribution_lists.txt`; do zmprov cdl $lists ; echo "$lists -- done " ; done
  23. cd /opt/zimbra/nfsbackup/migration/distribution_lists
  24. for list in `cat distribution_lists.txt`
  25. do
  26. for mbmr in `grep -v '#' ./$list.txt | grep '@'`
  27. do
  28. zmprov adlm $list $mbmr
  29. echo " $mbmr has been added to $list"
  30. done
  31. done
  32. echo
  33. echo "Importation des aliases :"
  34. cd /opt/zimbra/nfsbackup/migration/aliases
  35. for user in `cat /opt/zimbra/nfsbackup/migration/accounts/users.txt`
  36. do
  37. echo $user
  38. if [ -f "./$user.txt" ]; then
  39. for alias in `grep '@' ./$user.txt`
  40. do
  41. zmprov aaa $user $alias
  42. echo "$user ALIAS $alias - Restored"
  43. done
  44. fi
  45. done
  46. echo
  47. if [ $RCODE -eq 1 ]; then
  48. echo "erreur dans l'import'"
  49. exit 1;
  50. fi
  51. if [ $RCODE -eq 0 ]; then
  52. echo "Import terminée !!!!"
  53. echo "Passez à l'export des data sur serveur source"
  54. exit;
  55. fi