restart_web 799 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. # Internal vesta function
  3. # web system restart
  4. # Importing variables
  5. source $VESTA/conf/vars.conf
  6. # Restart functions
  7. apache() {
  8. /etc/init.d/httpd 'graceful' >/dev/null 2>&1
  9. if [ $? -ne 0 ]; then
  10. #$V_FUNC/report_issue 'web' 'apache'
  11. echo "$E_RESTART_FAILED $V_EVENT"
  12. fi
  13. }
  14. nginx() {
  15. /etc/init.d/nginx 'reload' >/dev/null 2>&1
  16. if [ $? -ne 0 ]; then
  17. #$V_FUNC/report_issue 'web' 'nginx'
  18. echo "$E_RESTART_FAILED $V_EVENT"
  19. fi
  20. }
  21. # Parsing config
  22. web_system=$(grep 'WEB_SYSTEM=' $V_CONF/vesta.conf | cut -f 2 -d \' )
  23. proxy_system=$(grep 'PROXY_SYSTEM=' $V_CONF/vesta.conf | cut -f 2 -d \' )
  24. # Checking values
  25. if [ "$web_system" = 'apache' ]; then
  26. apache
  27. fi
  28. if [ "$proxy_system" = 'nginx' ]; then
  29. nginx
  30. fi
  31. # Logging
  32. exit $OK