mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-21 05:44:07 -07:00
dns cluster support
This commit is contained in:
parent
0f7ea97e12
commit
68a34e18b7
47 changed files with 1536 additions and 64 deletions
62
bin/v-insert-dns-domain
Executable file
62
bin/v-insert-dns-domain
Executable file
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
# info: insert dns domain
|
||||
# options: USER DATA [SRC] [FLUSH]
|
||||
#
|
||||
# The function inserts raw record to the dns.conf
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=$1
|
||||
data=$2
|
||||
src=$3
|
||||
flush=$4
|
||||
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '2' "$#" 'USER DATA [SRC]'
|
||||
validate_format 'user' 'data'
|
||||
is_system_enabled "$DNS_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Prepare values for the insert
|
||||
eval $data
|
||||
dns_rec="DOMAIN='$DOMAIN' IP='$IP' TPL='$TPL' TTL='$TTL' EXP='$EXP'"
|
||||
dns_rec="$dns_rec SOA='$SOA' SRC='$src' RECORDS='$RECORDS'"
|
||||
dns_rec="$dns_rec SUSPENDED='$SUSPENDED' TIME='$TIME' DATE='$DATE'"
|
||||
sed -i "/DOMAIN='$DOMAIN'/d" $USER_DATA/dns.conf 2> /dev/null
|
||||
echo "$dns_rec" >> $USER_DATA/dns.conf
|
||||
chmod 660 $USER_DATA/dns.conf
|
||||
|
||||
# Flush dns records
|
||||
if [ "$flush" != 'no' ]; then
|
||||
rm -f $USER_DATA/dns/$DOMAIN.conf
|
||||
touch $USER_DATA/dns/$DOMAIN.conf
|
||||
chmod 660 $USER_DATA/dns/$DOMAIN.conf
|
||||
fi
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue