v-restart-proxy 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # info: restart proxy server
  3. # options: NONE
  4. #
  5. # The function reloads proxy 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. # Schedule restart
  16. if [ "$1" = 'scheduled' ]; then
  17. echo "$BIN/$SCRIPT now" >> $VESTA/data/queue/restart.pipe
  18. exit
  19. fi
  20. if [ -z "$1" ] && [ "$SCHEDULED_RESTART" = 'yes' ]; then
  21. echo "$BIN/$SCRIPT now" >> $VESTA/data/queue/restart.pipe
  22. exit
  23. fi
  24. # Restart system
  25. if [ ! -z "$PROXY_SYSTEM" ]; then
  26. /etc/init.d/$PROXY_SYSTEM reload >/dev/null 2>&1
  27. if [ $? -ne 0 ]; then
  28. /etc/init.d/$PROXY_SYSTEM restart >/dev/null 2>&1
  29. if [ $? -ne 0 ]; then
  30. exit $E_RESTART
  31. fi
  32. fi
  33. fi
  34. # Update restart queue
  35. if [ -e "$VESTA/data/queue/restart.pipe" ]; then
  36. sed -i "/$SCRIPT/d" $VESTA/data/queue/restart.pipe
  37. fi
  38. #----------------------------------------------------------#
  39. # Vesta #
  40. #----------------------------------------------------------#
  41. exit