1
0
mirror of https://github.com/serghey-rodin/vesta.git synced 2025-03-12 04:36:25 -07:00
vesta/bin/v-delete-mail-domains
ZonD Eighty 2b16d9bd83 Merge changes from upstream
I'm a little angry
2012-12-28 23:31:02 +04:00

48 lines
1.3 KiB
Bash
Executable File

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