mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-02-13 13:33:04 -08:00
59 lines
1.7 KiB
Bash
Executable File
59 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: delete webdomain ftp account.
|
|
# options: USER DOMAIN
|
|
#
|
|
# The function deletes additional ftp account.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument defenition
|
|
user=$1
|
|
domain=$(idn -t --quiet -u "$2" )
|
|
domain_idn=$(idn -t --quiet -a "$domain")
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/func/domain.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '2' "$#" 'USER DOMAIN'
|
|
validate_format 'user' 'domain'
|
|
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
|
|
is_object_valid 'user' 'USER' "$user"
|
|
is_object_unsuspended 'user' 'USER' "$user"
|
|
is_object_valid 'web' 'DOMAIN' "$domain"
|
|
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
|
is_object_value_exist 'web' 'DOMAIN' "$domain" '$FTP_USER'
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Deleting ftp user
|
|
get_domain_values 'web'
|
|
/usr/sbin/userdel -f $FTP_USER >> /dev/null 2>&1
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Update config
|
|
update_object_value 'web' 'DOMAIN' "$domain" '$FTP_USER' ''
|
|
update_object_value 'web' 'DOMAIN' "$domain" '$FTP_MD5' ''
|
|
|
|
# Logging
|
|
log_history "deleted ftp account $FTP_USER for $domain"
|
|
log_event "$OK" "$EVENT"
|
|
|
|
exit
|