zabbix_proxy.init 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. #
  3. # /etc/rc.d/init.d/zabbix_proxy
  4. #
  5. # Starts the zabbix_proxy daemon
  6. #
  7. # chkconfig: - 96 4
  8. # description: Zabbix Proxy Server
  9. # processname: zabbix_proxy
  10. # pidfile: /var/run/zabbix/zabbix_proxy.pid
  11. # Modified for Zabbix 2.0.0
  12. # May 2012, Zabbix SIA
  13. # 2013-02-07: IWAI, Masaharu; based zabbix_server script
  14. # Source function library.
  15. . /etc/init.d/functions
  16. RETVAL=0
  17. prog="Zabbix Proxy"
  18. ZABBIX_BIN="/usr/sbin/zabbix_proxy"
  19. if [ ! -x ${ZABBIX_BIN} ] ; then
  20. echo -n "${ZABBIX_BIN} not installed! "
  21. # Tell the user this has skipped
  22. exit 5
  23. fi
  24. start() {
  25. echo -n $"Starting $prog: "
  26. daemon $ZABBIX_BIN
  27. RETVAL=$?
  28. [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_proxy
  29. echo
  30. }
  31. stop() {
  32. echo -n $"Stopping $prog: "
  33. killproc $ZABBIX_BIN
  34. RETVAL=$?
  35. [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix_proxy
  36. echo
  37. }
  38. case "$1" in
  39. start)
  40. start
  41. ;;
  42. stop)
  43. stop
  44. ;;
  45. reload|restart)
  46. stop
  47. sleep 10
  48. start
  49. RETVAL=$?
  50. ;;
  51. condrestart)
  52. if [ -f /var/lock/subsys/zabbix_proxy ]; then
  53. stop
  54. start
  55. fi
  56. ;;
  57. status)
  58. status $ZABBIX_BIN
  59. RETVAL=$?
  60. ;;
  61. *)
  62. echo $"Usage: $0 {condrestart|start|stop|restart|reload|status}"
  63. exit 1
  64. esac
  65. exit $RETVAL