2013-01-19 23:07:26 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# info: search domain owner
|
|
|
|
# options: DOMAIN [TYPE]
|
|
|
|
#
|
|
|
|
# The function that allows to find user objects.
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Variable&Function #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
2015-11-06 17:38:58 +02:00
|
|
|
# Argument definition
|
2013-01-19 23:07:26 +02:00
|
|
|
domain=$(idn -t --quiet -u "$1" )
|
|
|
|
type=${2-any}
|
|
|
|
|
|
|
|
# Includes
|
|
|
|
source $VESTA/func/main.sh
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Verifications #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
check_args '1' "$#" 'DOMAIN [TYPE]'
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Action #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
# Define conf
|
|
|
|
case $type in
|
|
|
|
web) conf="$VESTA/data/users/*/web.conf" ;;
|
|
|
|
dns) conf="$VESTA/data/users/*/dns.conf" ;;
|
|
|
|
mail) conf="$VESTA/data/users/*/mail.conf" ;;
|
|
|
|
*) conf="$VESTA/data/users/*/*.conf"
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2013-02-11 18:34:29 +02:00
|
|
|
owner=$(grep -H "DOMAIN='$domain'" $conf | head -n 1 | cut -f7 -d '/')
|
2013-01-19 23:07:26 +02:00
|
|
|
if [ -z "$owner" ]; then
|
|
|
|
exit $E_NOTEXIST
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo $owner
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Vesta #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
# Logging
|
2016-06-09 16:31:56 +03:00
|
|
|
#log_event "$OK" "$ARGUMENTS"
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
exit
|