v-delete-web-domain-ftp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. # info: delete webdomain ftp account.
  3. # options: user domain
  4. #
  5. # The function deletes additional ftp account.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. domain=$(idn -t --quiet -u "$2" )
  12. domain_idn=$(idn -t --quiet -a "$domain")
  13. # Includes
  14. source $VESTA/conf/vesta.conf
  15. source $VESTA/func/main.sh
  16. source $VESTA/func/domain.sh
  17. #----------------------------------------------------------#
  18. # Verifications #
  19. #----------------------------------------------------------#
  20. check_args '2' "$#" 'user domain'
  21. validate_format 'user' 'domain'
  22. is_system_enabled "$WEB_SYSTEM"
  23. is_object_valid 'user' 'USER' "$user"
  24. is_object_unsuspended 'user' 'USER' "$user"
  25. is_object_valid 'web' 'DOMAIN' "$domain"
  26. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  27. is_object_value_exist 'web' 'DOMAIN' "$domain" '$FTP_USER'
  28. #----------------------------------------------------------#
  29. # Action #
  30. #----------------------------------------------------------#
  31. # Adding user
  32. get_domain_values 'web'
  33. /usr/sbin/userdel $FTP_USER
  34. #----------------------------------------------------------#
  35. # Vesta #
  36. #----------------------------------------------------------#
  37. # Update config
  38. update_object_value 'web' 'DOMAIN' "$domain" '$FTP_USER' ''
  39. update_object_value 'web' 'DOMAIN' "$domain" '$FTP_MD5' ''
  40. # Logging
  41. log_history "deleted ftp account $FTP_USER for $domain"
  42. log_event "$OK" "$EVENT"
  43. exit