myvesta/bin/v-suspend-mail-accounts

58 lines
1.6 KiB
Plaintext
Raw Normal View History

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
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
source $VESTA/conf/vesta.conf
2013-01-19 23:07:26 +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 ?
2013-01-19 23:07:26 +02:00
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'USER DOMAIN'
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
#log_event "$OK" "$ARGUMENTS"
2013-01-19 23:07:26 +02:00
exit