Added dns tab triggers. Issue #50

This commit is contained in:
Serghey Rodin 2012-02-20 14:59:11 +02:00
commit 0757a13493
6 changed files with 25 additions and 13 deletions

View file

@ -100,9 +100,11 @@ cat $V_DNSTPL/$template.tpl |\
-e "s/%ns8%/$ns8/g" \
-e "s/%date%/$V_DATE/g" > $V_USERS/$user/dns/$domain
records="$(wc -l $V_USERS/$user/dns/$domain)"
# Adding dns.conf record
dns_rec="DOMAIN='$domain' IP='$ip' TPL='$template' TTL='$ttl' EXP='$exp'"
dns_rec="$dns_rec SOA='$soa' SUSPENDED='no' DATE='$V_DATE'"
dns_rec="$dns_rec SOA='$soa' RECORDS='$records' SUSPENDED='no' DATE='$V_DATE'"
echo "$dns_rec" >> $V_USERS/$user/dns.conf
chmod 660 $V_USERS/$user/dns.conf
@ -125,6 +127,7 @@ chown root:named $conf
# Increasing domain value
increase_user_value "$user" '$U_DNS_DOMAINS'
increase_user_value "$user" '$U_DNS_RECORDS' "$records"
# Adding task to the vesta pipe
restart_schedule 'dns'

View file

@ -91,6 +91,13 @@ update_domain_zone
# Vesta #
#----------------------------------------------------------#
# Updating dns domain values
records="$(wc -l $V_USERS/$user/dns/$domain)"
update_dns_domain_value '$RECORDS' "$records"
# Updating user counters
increase_user_value "$user" '$U_DNS_RECORDS'
# Adding task to the vesta pipe
restart_schedule 'dns'

View file

@ -44,6 +44,9 @@ is_user_suspended
# Action #
#----------------------------------------------------------#
user_records=0
suspended_dns=0
# Checking dns folder
if [ ! -d "$V_USERS/$user/dns" ]; then
rm -f $V_USERS/$user/dns
@ -117,6 +120,7 @@ for domain in $domains; do
if [ ! -z "$rm_string" ]; then
sed -i "$rm_string d" $nconf
fi
suspended_dns=$((suspended_dns + 1))
else
if [ -z "$(grep /$domain.db $nconf)" ]; then
named="zone \"$domain_idn\" {type master; file"
@ -124,6 +128,9 @@ for domain in $domains; do
echo "$named" >> /etc/named.conf
fi
fi
records=$(wc -l $V_USERS/$user/dns/$domain | cut -f 1 -d ' ')
user_records=$((user_records + records))
update_dns_domain_value '$RECORDS' "$records"
done
@ -131,6 +138,10 @@ done
# Vesta #
#----------------------------------------------------------#
# Updating counters
update_user_value "$user" '$U_DNS_RECORDS' "$user_records"
update_user_value "$user" '$SUSPENDED_DNS' "$suspended_dns"
# Adding task to the vesta pipe
restart_schedule 'dns'

View file

@ -63,6 +63,7 @@ fi
# Adding suspend in config
update_dns_domain_value '$SUSPENDED' 'yes'
increase_user_value "$user" '$SUSPENDED_DNS'
# Adding task to the vesta pipe
restart_schedule 'dns'

View file

@ -45,23 +45,12 @@ conf="$V_USERS/$user/dns.conf"
# Defining fileds to select
field='$DOMAIN'
# Defining search string
search_string="SUSPENDED='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 '$SUSPENDED' 'yes'
$V_BIN/v_suspend_web_domain "$user" "$domain" "$url"
done

View file

@ -61,6 +61,7 @@ echo "$nmd_rec" >> $conf
# Unsuspending domain in config
update_dns_domain_value '$SUSPENDED' 'no'
decrease_user_value "$user" '$SUSPENDED_DNS'
# Adding task to the vesta pipe
restart_schedule 'dns'