v-restart-web 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # info: restart web services
  3. # options: NONE
  4. #
  5. # The function reloads web server configuration.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Includes
  10. source $VESTA/conf/vesta.conf
  11. source $VESTA/func/main.sh
  12. #----------------------------------------------------------#
  13. # Action #
  14. #----------------------------------------------------------#
  15. if [ "$WEB_SYSTEM" = 'apache' ]; then
  16. /etc/init.d/httpd status >/dev/null 2>&1
  17. if [ $? -eq 0 ]; then
  18. /etc/init.d/httpd graceful >/dev/null 2>&1
  19. if [ $? -ne 0 ]; then
  20. exit $E_RESTART
  21. fi
  22. else
  23. /etc/init.d/httpd start >/dev/null 2>&1
  24. if [ $? -ne 0 ]; then
  25. exit $E_RESTART
  26. fi
  27. fi
  28. fi
  29. if [ "$PROXY_SYSTEM" = 'nginx' ]; then
  30. /etc/init.d/nginx status >/dev/null 2>&1
  31. if [ $? -eq 0 ]; then
  32. /etc/init.d/nginx reload >/dev/null 2>&1
  33. if [ $? -ne 0 ]; then
  34. exit $E_RESTART
  35. fi
  36. else
  37. /etc/init.d/nginx start >/dev/null 2>&1
  38. if [ $? -ne 0 ]; then
  39. exit $E_RESTART
  40. fi
  41. fi
  42. fi
  43. #----------------------------------------------------------#
  44. # Vesta #
  45. #----------------------------------------------------------#
  46. exit