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

49 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# info: suspend mail domains
# options: USER
#
# The function suspends all user's MAIL domains.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user=$1
# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER'
is_format_valid 'user'
is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Starting suspend loop
for domain in $(search_objects 'mail' 'SUSPENDED' "no" 'DOMAIN'); do
$BIN/v-suspend-mail-domain "$user" "$domain"
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit