v_restart_web 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. # info: restart dns service
  3. # options: none
  4. #
  5. # The function tells BIND service to reload dns zone files.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Importing variables
  10. source $VESTA/conf/vars.conf
  11. source $V_CONF/vesta.conf
  12. # Restart functions
  13. apache() {
  14. /etc/init.d/httpd status >/dev/null 2>&1
  15. if [ $? -eq 0 ]; then
  16. /etc/init.d/httpd graceful >/dev/null 2>&1
  17. if [ $? -ne 0 ]; then
  18. echo "$E_RESTART $1"
  19. exit $E_RESTART
  20. fi
  21. else
  22. /etc/init.d/httpd start >/dev/null 2>&1
  23. if [ $? -ne 0 ]; then
  24. echo "$E_RESTART $1"
  25. exit $E_RESTART
  26. fi
  27. fi
  28. }
  29. nginx() {
  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. echo "$E_RESTART $1"
  35. exit $E_RESTART
  36. fi
  37. else
  38. /etc/init.d/nginx start >/dev/null 2>&1
  39. if [ $? -ne 0 ]; then
  40. echo "$E_RESTART $1"
  41. exit $E_RESTART
  42. fi
  43. fi
  44. }
  45. #----------------------------------------------------------#
  46. # Action #
  47. #----------------------------------------------------------#
  48. # Checking system
  49. if [ "$WEB_SYSTEM" = 'apache' ]; then
  50. apache $1
  51. fi
  52. if [ "$PROXY_SYSTEM" = 'nginx' ]; then
  53. nginx $1
  54. fi
  55. #----------------------------------------------------------#
  56. # Vesta #
  57. #----------------------------------------------------------#
  58. # Logging
  59. exit