remote dns host management

This commit is contained in:
Serghey Rodin 2013-05-29 12:39:50 +03:00
commit bab24899ea
6 changed files with 299 additions and 2 deletions

56
bin/v-delete-remote-dns-host Executable file
View file

@ -0,0 +1,56 @@
#!/bin/bash
# info: delete remote dns host
# options: HOST
#
# The function for deleting the remote dns host from vesta configuration.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
host=$1
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'HOST'
validate_format 'host'
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
is_object_valid "../../conf/dns-cluster" 'HOST' "$host"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Deleting domains
$BIN/v-delete-remote-dns-domains $host >>/dev/null 2>&1
# Deleting server
sed -i "/HOST='$host' /d" $VESTA/conf/dns-cluster.conf
# Disabling DNS_CLUSTER
check_cluster=$(grep HOST $VESTA/conf/dns-cluster.conf |wc -l)
if [ "$check_cluster" -eq '0' ]; then
rm -f $VESTA/conf/dns-cluster.conf
sed -i "/DNS_CLUSTER=/d" $VESTA/conf/vesta.conf
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_history "deleted $type database server $host" '' 'admin'
log_event "$OK" "$EVENT"
exit