v-suspend-web-domains 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 defenition
  10. user=$1
  11. restart=$2
  12. # Includes
  13. source $VESTA/conf/vesta.conf
  14. source $VESTA/func/main.sh
  15. source $VESTA/func/domain.sh
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. check_args '1' "$#" 'user [restart]'
  20. validate_format 'user'
  21. is_system_enabled "$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. # Restart web server
  34. if [ "$restart" != 'no' ]; then
  35. $BIN/v-restart-web "$EVENT"
  36. fi
  37. # Logging
  38. log_event "$OK" "$EVENT"
  39. exit