myvesta/bin/v-delete-dns-domains
2014-02-19 23:12:23 +02:00

54 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# info: delete dns domains
# options: USER
#
# The function for deleting all users DNS domains.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER'
validate_format '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 #
#----------------------------------------------------------#
# Restart named
$BIN/v-restart-dns
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
# Logging
log_event "$OK" "$EVENT"
exit