vesta/bin/v_suspend_dns_domain
2011-06-30 01:00:27 +03:00

69 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# info: suspening dns domain
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user="$1"
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
# 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 '2' "$#" 'user domain'
# Checking argument format
format_validation 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'dns'
# Checking user
is_user_valid
# Checking domain exist
is_dns_domain_valid
# Checking domain is not suspened
is_domain_suspended 'dns'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining 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
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Adding suspend in config
update_dns_domain_value '$SUSPEND' 'yes'
# Adding task to the vesta pipe
restart_schedule 'dns'
# Logging
log_event 'system' "$V_EVENT"
exit $OK