v-suspend-web-domains 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. # info: suspend web domains
  3. # options: USER [RESTART]
  4. #
  5. # The function of suspending all user's sites.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. user=$1
  11. restart=$2
  12. # Includes
  13. source $VESTA/func/main.sh
  14. source $VESTA/func/domain.sh
  15. source $VESTA/conf/vesta.conf
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. check_args '1' "$#" 'USER [RESTART]'
  20. is_format_valid 'user'
  21. is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
  22. is_object_valid 'user' 'USER' "$user"
  23. #----------------------------------------------------------#
  24. # Action #
  25. #----------------------------------------------------------#
  26. # Starting suspend loop
  27. for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
  28. $BIN/v-suspend-web-domain "$user" "$domain" 'no'
  29. done
  30. #----------------------------------------------------------#
  31. # Vesta #
  32. #----------------------------------------------------------#
  33. # Restarting web server
  34. $BIN/v-restart-web $restart
  35. check_result $? "Web restart failed" >/dev/null
  36. $BIN/v-restart-proxy $restart
  37. check_result $? "Proxy restart failed" >/dev/null
  38. # Logging
  39. log_event "$OK" "$ARGUMENTS"
  40. exit