v_delete_web_domain_stat 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. # info: adding web domain
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user=$1
  8. domain=$(idn -t --quiet -u "$2" )
  9. # Importing variables
  10. source $VESTA/conf/vars.conf
  11. source $V_CONF/vesta.conf
  12. source $V_FUNC/shared.func
  13. source $V_FUNC/domain.func
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. # Checking arg number
  18. check_args '2' "$#" 'user domain'
  19. # Checking argument format
  20. format_validation 'user' 'domain'
  21. # Checking web system is enabled
  22. is_system_enabled 'web'
  23. # Checking user
  24. is_user_valid
  25. # Checking user is active
  26. is_user_suspended
  27. # Checking domain exist
  28. is_web_domain_valid
  29. # Checking domain is not suspened
  30. is_domain_suspended 'web'
  31. # Checking stats enabled
  32. is_web_domain_value_exist '$STATS'
  33. #----------------------------------------------------------#
  34. # Action #
  35. #----------------------------------------------------------#
  36. # Defining statistic type
  37. type=$(get_web_domain_value '$STATS')
  38. # Defining statistic dir
  39. stat_dir="$V_HOME/$user/web/$domain/stats"
  40. # Deleting dir content
  41. rm -rf $stat_dir/*
  42. # Deleting config
  43. rm -f $V_HOME/$user/conf/$type.$domain.conf
  44. #----------------------------------------------------------#
  45. # Vesta #
  46. #----------------------------------------------------------#
  47. # Deleting pipe command
  48. sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
  49. # Deleting stats
  50. update_web_domain_value '$STATS' ''
  51. # Logging
  52. log_history "$V_EVENT" "v_add_web_domain_stat $user $doman $type"
  53. log_event 'system' "$V_EVENT"
  54. exit