v-search-domain-owner 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. # info: search domain owner
  3. # options: DOMAIN [TYPE]
  4. #
  5. # The function that allows to find user objects.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. domain=$(idn -t --quiet -u "$1" )
  11. type=${2-any}
  12. # Includes
  13. source $VESTA/func/main.sh
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. check_args '1' "$#" 'DOMAIN [TYPE]'
  18. #----------------------------------------------------------#
  19. # Action #
  20. #----------------------------------------------------------#
  21. # Define conf
  22. case $type in
  23. web) conf="$VESTA/data/users/*/web.conf" ;;
  24. dns) conf="$VESTA/data/users/*/dns.conf" ;;
  25. mail) conf="$VESTA/data/users/*/mail.conf" ;;
  26. *) conf="$VESTA/data/users/*/*.conf"
  27. esac
  28. owner=$(grep -H "DOMAIN='$domain'" $conf | head -n 1 | cut -f7 -d '/')
  29. if [ -z "$owner" ]; then
  30. exit $E_NOTEXIST
  31. fi
  32. echo $owner
  33. #----------------------------------------------------------#
  34. # Vesta #
  35. #----------------------------------------------------------#
  36. # Logging
  37. #log_event "$OK" "$ARGUMENTS"
  38. exit