v_del_web_domain_stat 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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_FUNC/shared_func.sh
  12. source $V_FUNC/domain_func.sh
  13. #----------------------------------------------------------#
  14. # Verifications #
  15. #----------------------------------------------------------#
  16. # Checking arg number
  17. check_args '2' "$#" 'user domain'
  18. # Checking argument format
  19. format_validation 'user' 'domain'
  20. # Checking web system is enabled
  21. is_system_enabled 'web'
  22. # Checking user
  23. is_user_valid
  24. # Checking user is active
  25. is_user_suspended
  26. # Checking domain exist
  27. is_web_domain_valid
  28. # Checking domain is not suspened
  29. is_domain_suspended 'web'
  30. # Checking stats enabled
  31. is_web_domain_value_exist '$STATS'
  32. #----------------------------------------------------------#
  33. # Action #
  34. #----------------------------------------------------------#
  35. # Defining statistic type
  36. type=$(get_web_domain_value '$STATS')
  37. # Defining statistic dir
  38. stat_dir="$V_HOME/$user/web/$domain/stats"
  39. # Deleting dir content
  40. rm -rf $stat_dir/*
  41. # Deleting config
  42. rm -f $V_HOME/$user/conf/$type.$domain.conf
  43. #----------------------------------------------------------#
  44. # Vesta #
  45. #----------------------------------------------------------#
  46. # Parsing pipe line
  47. line=$(grep -n "$type.$domain.conf" $V_QUEUE/stats.pipe | \
  48. cut -f 1 -d : | head -n 1 )
  49. # Deleting pipe command
  50. if [ ! -z "$line" ]; then
  51. sed -i "$line d" $V_QUEUE/stats.pipe
  52. fi
  53. # Deleting stats
  54. update_web_domain_value '$STATS' ''
  55. # Logging
  56. log_history "$V_EVENT" "v_add_web_domain_stat $user $doman $type"
  57. log_event 'system' "$V_EVENT"
  58. exit $OK