mirror of
https://github.com/myvesta/vesta
synced 2025-07-06 04:51:54 -07:00
58 lines
1.7 KiB
Bash
Executable file
58 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/conf/vesta.conf
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/func/domain.sh
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '2' "$#" 'user domain'
|
|
validate_format 'user' 'domain'
|
|
is_system_enabled "$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 #
|
|
#----------------------------------------------------------#
|
|
|
|
# Adding user
|
|
get_domain_values 'web'
|
|
/usr/sbin/userdel $FTP_USER
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# 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
|