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.

57 lines
1.5 KiB

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