2013-01-19 23:07:26 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# info: suspend all mail domain accounts
|
|
|
|
# options: USER DOMAIN
|
|
|
|
#
|
|
|
|
# The function suspends all mail domain accounts.
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Variable&Function #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
2015-11-06 17:38:58 +02:00
|
|
|
# Argument definition
|
2013-01-19 23:07:26 +02:00
|
|
|
user=$1
|
2017-01-11 16:52:11 +02:00
|
|
|
domain=$2
|
2017-03-05 23:34:07 +01:00
|
|
|
domain_idn=$2
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
# Includes
|
|
|
|
source $VESTA/func/main.sh
|
2013-10-09 00:50:08 +03:00
|
|
|
source $VESTA/conf/vesta.conf
|
2013-01-19 23:07:26 +02:00
|
|
|
|
2017-01-11 16:52:11 +02:00
|
|
|
# Additional argument formatting
|
|
|
|
format_domain
|
2017-03-05 23:34:07 +01:00
|
|
|
format_domain_idn
|
|
|
|
# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
|
2017-01-11 16:52:11 +02:00
|
|
|
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Verifications #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
check_args '2' "$#" 'USER DOMAIN'
|
2016-06-09 16:31:56 +03:00
|
|
|
is_format_valid 'user' 'domain'
|
2013-05-29 13:16:09 +03:00
|
|
|
is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
|
2013-01-19 23:07:26 +02:00
|
|
|
is_object_valid 'user' 'USER' "$user"
|
|
|
|
is_object_unsuspended 'user' 'USER' "$user"
|
|
|
|
is_object_valid 'mail' 'DOMAIN' "$domain"
|
|
|
|
is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Action #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
# Starting suspend loop
|
|
|
|
for account in $(search_objects "mail/$domain" 'SUSPENDED' "no" 'ACCOUNT'); do
|
|
|
|
$BIN/v-suspend-mail-account "$user" "$domain" "$account"
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Vesta #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
# No Logging
|
2016-06-09 16:31:56 +03:00
|
|
|
#log_event "$OK" "$ARGUMENTS"
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
exit
|