v-restart-service 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. # info: restart service
  3. # options: service
  4. #
  5. # The function restarts system service.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. service=$1
  11. # Includes
  12. source $VESTA/func/main.sh
  13. PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. check_args '1' "$#" 'SERVICE'
  18. #----------------------------------------------------------#
  19. # Action #
  20. #----------------------------------------------------------#
  21. if [ "$service" != "iptables" ]; then
  22. service $service restart >/dev/null 2>&1
  23. if [ $? -ne 0 ]; then
  24. check_result $E_RESTART "$service restart failed"
  25. fi
  26. else
  27. $BIN/v-stop-firewall
  28. $BIN/v-update-firewall
  29. if [ $? -ne 0 ]; then
  30. check_result $E_RESTART "$service restart failed"
  31. fi
  32. fi
  33. #----------------------------------------------------------#
  34. # Vesta #
  35. #----------------------------------------------------------#
  36. exit