2013-01-19 23:07:26 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# info: suspend dns domain record
|
|
|
|
# options: USER DOMAIN ID [RESTART]
|
|
|
|
#
|
|
|
|
# The function suspends a certain domain record.
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Variable&Function #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
2015-11-06 17:38:58 +02:00
|
|
|
# Argument definition
|
2013-01-19 23:07:26 +02:00
|
|
|
user=$1
|
2017-01-11 16:52:11 +02:00
|
|
|
domain=$2
|
2017-03-05 23:34:07 +01:00
|
|
|
domain_idn=$2
|
2013-01-19 23:07:26 +02:00
|
|
|
id=$3
|
2017-01-11 16:52:11 +02:00
|
|
|
restart=$4
|
2016-06-28 15:38:11 +03:00
|
|
|
|
2013-01-19 23:07:26 +02:00
|
|
|
# Includes
|
|
|
|
source $VESTA/func/main.sh
|
|
|
|
source $VESTA/func/domain.sh
|
2013-10-09 00:50:08 +03:00
|
|
|
source $VESTA/conf/vesta.conf
|
2013-01-19 23:07:26 +02:00
|
|
|
|
2017-01-11 16:52:11 +02:00
|
|
|
# Additional argument formatting
|
|
|
|
format_domain
|
|
|
|
format_domain_idn
|
2017-03-05 23:34:07 +01:00
|
|
|
# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
|
2017-01-11 16:52:11 +02:00
|
|
|
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Verifications #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
check_args '3' "$#" 'USER DOMAIN ID [RESTART]'
|
2016-06-09 16:31:56 +03:00
|
|
|
is_format_valid 'user' 'domain' 'id'
|
2013-05-29 13:16:09 +03:00
|
|
|
is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM'
|
2013-01-19 23:07:26 +02:00
|
|
|
is_object_valid 'user' 'USER' "$user"
|
|
|
|
is_object_valid 'dns' 'DOMAIN' "$domain"
|
|
|
|
is_object_unsuspended 'dns' 'DOMAIN' "$domain"
|
|
|
|
is_object_valid "dns/$domain" 'ID' "$id"
|
|
|
|
is_object_unsuspended "dns/$domain" 'ID' "$id"
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Action #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
line=$(grep "ID='$id'" $USER_DATA/dns/$domain.conf)
|
|
|
|
eval $line
|
|
|
|
sed -i "/^ID='$id'/d" $USER_DATA/dns/$domain.conf
|
|
|
|
|
|
|
|
# Adding record
|
|
|
|
dns_rec="ID='$id' RECORD='$RECORD' TYPE='$TYPE' PRIORITY='$PRIORITY'"
|
|
|
|
dns_rec="$dns_rec VALUE='$VALUE' SUSPENDED='yes' TIME='$TIME' DATE='$DATE'"
|
|
|
|
echo "$dns_rec" >> $USER_DATA/dns/$domain.conf
|
|
|
|
|
|
|
|
# Sorting records
|
|
|
|
sort_dns_records
|
|
|
|
|
|
|
|
# Updating zone
|
2014-03-23 18:49:18 +02:00
|
|
|
if [[ "$DNS_SYSTEM" =~ named|bind ]]; then
|
2015-10-15 15:03:23 +03:00
|
|
|
update_domain_serial
|
2014-03-23 18:49:18 +02:00
|
|
|
update_domain_zone
|
|
|
|
fi
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Vesta #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
# Logging
|
2016-06-09 16:31:56 +03:00
|
|
|
log_event "$OK" "$ARGUMENTS"
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
exit
|