You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							53 lines
						
					
					
						
							1.5 KiB
						
					
					
				
			
		
		
	
	
							53 lines
						
					
					
						
							1.5 KiB
						
					
					
				#!/bin/bash
 | 
						|
# info: delete mail domains
 | 
						|
# options: USER
 | 
						|
#
 | 
						|
# example: v-delete-mail-domains admin
 | 
						|
#
 | 
						|
# This function for deleting all users mail domains.
 | 
						|
 | 
						|
#----------------------------------------------------------#
 | 
						|
#                Variables & Functions                     #
 | 
						|
#----------------------------------------------------------#
 | 
						|
 | 
						|
# Argument definition
 | 
						|
user=$1
 | 
						|
 | 
						|
# Includes
 | 
						|
# shellcheck source=/etc/hestiacp/hestia.conf
 | 
						|
source /etc/hestiacp/hestia.conf
 | 
						|
# shellcheck source=/usr/local/hestia/func/main.sh
 | 
						|
source $HESTIA/func/main.sh
 | 
						|
# load config file
 | 
						|
source_conf "$HESTIA/conf/hestia.conf"
 | 
						|
 | 
						|
#----------------------------------------------------------#
 | 
						|
#                    Verifications                         #
 | 
						|
#----------------------------------------------------------#
 | 
						|
 | 
						|
check_args '1' "$#" 'USER'
 | 
						|
is_format_valid 'user'
 | 
						|
is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
 | 
						|
is_object_valid 'user' 'USER' "$user"
 | 
						|
 | 
						|
# Perform verification if read-only mode is enabled
 | 
						|
check_hestia_demo_mode
 | 
						|
 | 
						|
#----------------------------------------------------------#
 | 
						|
#                       Action                             #
 | 
						|
#----------------------------------------------------------#
 | 
						|
 | 
						|
# Starting delete loop
 | 
						|
for domain in $(search_objects 'mail' 'SUSPENDED' "no" 'DOMAIN'); do
 | 
						|
	$BIN/v-delete-mail-domain "$user" "$domain"
 | 
						|
done
 | 
						|
 | 
						|
#----------------------------------------------------------#
 | 
						|
#                       Hestia                             #
 | 
						|
#----------------------------------------------------------#
 | 
						|
 | 
						|
# Logging
 | 
						|
log_event "$OK" "$ARGUMENTS"
 | 
						|
 | 
						|
exit
 |