forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv_suspend_dns_domains
More file actions
executable file
·73 lines (52 loc) · 1.73 KB
/
Copy pathv_suspend_dns_domains
File metadata and controls
executable file
·73 lines (52 loc) · 1.73 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
#!/bin/bash
# info: suspening dns domains
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user="$1"
# Importing variables
source $VESTA/conf/vars.conf
source $V_FUNC/shared_func.sh
source $V_FUNC/domain_func.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user'
# Checking argument format
format_validation 'user'
# Checking dns system is enabled
is_system_enabled 'dns'
# Checking user
is_user_valid
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config
conf="$V_USERS/$user/dns.conf"
# Defining fileds to select
field='$DOMAIN'
# Defining search string
search_string="SUSPEND='no'"
# Parsing unsuspeneded domains
domains=$(dom_clear_search)
# Starting suspend loop
for domain in $domains; do
# Defining named config
conf="/etc/named.conf"
rm_string=$(grep -n /etc/namedb/$domain.db $conf|cut -d : -f 1)
if [ ! -z "$rm_string" ]; then
sed -i "$rm_string d" $conf
fi
# Adding suspend in config
update_dns_domain_value '$SUSPEND' 'yes'
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Adding task to the vesta pipe
restart_schedule 'dns'
# Logging
log_event 'system' "$V_EVENT"
exit $OK