myvesta/bin/v-suspend-dns-domains
2016-06-09 16:55:35 +03:00

49 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# info: suspend dns domains
# options: USER [RESTART]
#
# The function suspends all user's 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 [RESTART]'
is_format_valid 'user'
is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Starting suspend loop
for domain in $(search_objects 'dns' 'SUSPENDED' "no" 'DOMAIN'); do
$BIN/v-suspend-dns-domain "$user" "$domain" 'no'
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit