mirror of
https://github.com/myvesta/vesta
synced 2025-07-05 20:41:53 -07:00
Create v-get-dns-config
This commit is contained in:
parent
c32bd2c709
commit
c148a1ed79
1 changed files with 70 additions and 0 deletions
70
bin/v-get-dns-config
Normal file
70
bin/v-get-dns-config
Normal file
|
@ -0,0 +1,70 @@
|
|||
#!/bin/bash
|
||||
# info: Get domain DNS config.db file content
|
||||
# options: DOMAIN
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
whoami=$(whoami)
|
||||
if [ "$whoami" != "root" ]; then
|
||||
echo "You must be root to execute this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Importing system environment
|
||||
source /etc/profile
|
||||
|
||||
SILENT_MODE=1
|
||||
|
||||
# Argument definition
|
||||
domain=$1
|
||||
|
||||
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
|
||||
USER=$user
|
||||
|
||||
# Includes
|
||||
source /usr/local/vesta/func/main.sh
|
||||
source /usr/local/vesta/func/domain.sh
|
||||
|
||||
if [ -z "$user" ]; then
|
||||
check_result $E_NOTEXIST "domain $domain doesn't exist"
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '1' "$#" 'DOMAIN'
|
||||
is_format_valid 'domain'
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
if [ ! -d "/home/$user" ]; then
|
||||
# echo "User doesn't exist";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
|
||||
# echo "Domain doesn't exist";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
DNS_FILE="/home/$user/conf/dns/$domain.db"
|
||||
|
||||
if [ -f "$DNS_FILE" ]; then
|
||||
cat "$DNS_FILE"
|
||||
else
|
||||
echo "DNS configuration file for $domain does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit 0;
|
Loading…
Add table
Add a link
Reference in a new issue