forked from outroll/vesta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathv-search-domain-owner
executable file
·55 lines (38 loc) · 1.38 KB
/
v-search-domain-owner
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# info: search domain owner
# options: DOMAIN [TYPE]
#
# The function that allows to find user objects.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
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
owner=$(grep -H "DOMAIN='$domain'" $conf | head -n 1 | cut -f7 -d '/')
if [ -z "$owner" ]; then
exit $E_NOTEXIST
fi
echo $owner
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
#log_event "$OK" "$EVENT"
exit