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.

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