mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
dns cluster support
This commit is contained in:
parent
0f7ea97e12
commit
68a34e18b7
47 changed files with 1536 additions and 64 deletions
75
bin/v-change-dns-record-id
Executable file
75
bin/v-change-dns-record-id
Executable file
|
@ -0,0 +1,75 @@
|
|||
#!/bin/bash
|
||||
# info: change dns domain record id
|
||||
# options: USER DOMAIN ID NEWID [RESTART]
|
||||
#
|
||||
# The function for changing internal record id.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=$1
|
||||
domain=$(idn -t --quiet -u "$2" )
|
||||
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
id=$3
|
||||
newid=$4
|
||||
restart=$5
|
||||
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/main.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '4' "$#" 'USER DOMAIN ID NEWID [RESTART]'
|
||||
validate_format 'user' 'domain' 'id' 'newid'
|
||||
is_system_enabled "$DNS_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
is_object_valid 'dns' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'dns' 'DOMAIN' "$domain"
|
||||
is_object_valid "dns/$domain" 'ID' "$id"
|
||||
is_object_new "dns/$domain" 'ID' "$newid"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Change id
|
||||
sed -i "s/^ID='$id'/ID='$newid'/" $USER_DATA/dns/$domain.conf
|
||||
|
||||
# Sorting records
|
||||
sort_dns_records
|
||||
|
||||
# Updating zone
|
||||
update_domain_zone
|
||||
|
||||
# dns-cluster
|
||||
if [ ! -z "$DNS_CLUSTER" ]; then
|
||||
cmd="v-add-remote-dns-domain $user $domain"
|
||||
echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
|
||||
fi
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Restart named
|
||||
if [ "$restart" != 'no' ]; then
|
||||
$BIN/v-restart-dns
|
||||
fi
|
||||
|
||||
# Logging
|
||||
log_history "changed dns record id on $domain"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue