#!/bin/bash # info: change remote dns domain expiriation date # options: USER DOMAIN # # The function synchronize dns domain with the remote server. #----------------------------------------------------------# # Variable&Function # #----------------------------------------------------------# # Argument defenition 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' validate_format 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" fi if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then check_result $E_EXISTS "another sync process already running" fi remote_dns_health_check #----------------------------------------------------------# # Action # #----------------------------------------------------------# IFS=$'\n' for cluster in $(grep "SUSPENDED='no'" $VESTA/conf/dns-cluster.conf); do # Parsing remote host parameters eval $cluster # Syncing domain str=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf) cluster_cmd v-insert-dns-domain $DNS_USER "$str" $HOSTNAME 'no' check_result $? "$HOST connection failed (exp insert)" $E_CONNECT done #----------------------------------------------------------# # Vesta # #----------------------------------------------------------# # Updating pipe pipe="$VESTA/data/queue/dns-cluster.pipe" str=$(grep -n "$SCRIPT $1 $2 $3$" $pipe | cut -f1 -d: | head -n1) if [ ! -z "$str" ]; then sed -i "$str d" $pipe fi exit