mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-20 20:40:08 -08:00
66 lines
1.7 KiB
Bash
Executable File
66 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: delete remote dns domain
|
|
# options: USER DOMAIN
|
|
#
|
|
# The function synchronize dns with the remote server.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
user=$1
|
|
domain=$2
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/func/remote.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '2' "$#" 'USER DOMAIN'
|
|
is_format_valid 'user' 'domain'
|
|
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
|
|
is_procces_running
|
|
remote_dns_health_check
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Starting cluster loop
|
|
IFS=$'\n'
|
|
for cluster in $(grep "SUSPENDED='no'" $VESTA/conf/dns-cluster.conf); do
|
|
|
|
# Parsing remote host parameters
|
|
eval $cluster
|
|
|
|
# Syncing domain
|
|
cluster_cmd v-delete-dns-domain $DNS_USER $domain 'yes'
|
|
rc=$?
|
|
if [ "$rc" -ne 0 ] && [ $rc -ne 3 ]; then
|
|
check_result $rc "$HOST connection failed (sync)" $E_CONNECT
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Updating pipe
|
|
pipe="$VESTA/data/queue/dns-cluster.pipe"
|
|
str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1)
|
|
if [ ! -z "$str" ]; then
|
|
sed -i "$str d" $pipe
|
|
fi
|
|
|
|
exit
|