forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv-delete-domain
More file actions
executable file
·80 lines (65 loc) · 2.2 KB
/
Copy pathv-delete-domain
File metadata and controls
executable file
·80 lines (65 loc) · 2.2 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# info: delete web/dns/mail domain
# options: USER DOMAIN
#
# The function deletes web/dns/mail domain.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
domain=$2
# Includes
source $VESTA/func/main.sh
source $VESTA/func/ip.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'USER DOMAIN'
validate_format 'user' 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Web domain
if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
check_web=$(grep "DOMAIN='$domain'" $USER_DATA/web.conf)
if [ ! -z "$check_web" ]; then
$BIN/v-delete-web-domain $user $domain
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
fi
fi
# DNS domain
if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
check_dns=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf)
if [ ! -z "$check_dns" ]; then
$BIN/v-delete-dns-domain $user $domain
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
fi
fi
# Mail domain
if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then
check_mail=$(grep "DOMAIN='$domain'" $USER_DATA/mail.conf)
if [ ! -z "$check_mail" ]; then
$BIN/v-delete-mail-domain $user $domain
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
fi
fi
# Check domain status
if [ -z "$check_web" ] && [ -z "$check_dns" ] && [ -z "$check_mail" ]; then
echo "Error: domain $domain doesn't exist"
log_event "$E_NOTEXIST $EVENT"
exit $E_NOTEXIST
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit