mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-03 04:00:20 -08:00
53 lines
1.4 KiB
Bash
Executable File
53 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: delete dns domains
|
|
# options: USER
|
|
#
|
|
# The function for deleting all users DNS domains.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
user=$1
|
|
restart=$2
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '1' "$#" 'USER'
|
|
is_format_valid 'user'
|
|
is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM'
|
|
is_object_valid 'user' 'USER' "$user"
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Starting delete loop
|
|
for domain in $(search_objects 'dns' 'SUSPENDED' "no" 'DOMAIN'); do
|
|
$BIN/v-delete-dns-domain "$user" "$domain" 'no'
|
|
done
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Restarting named
|
|
$BIN/v-restart-dns $restart
|
|
check_result $? "Bind restart failed" >/dev/null
|
|
|
|
# Logging
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|