| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #!/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
|