文件位置: etc/init.d/zabbix-server

    1. #!/bin/sh
    2. # Zabbix
    3. # Copyright (C) 2001-2017 Zabbix SIA
    4. #
    5. # This program is free software; you can redistribute it and/or modify
    6. # it under the terms of the GNU General Public License as published by
    7. # the Free Software Foundation; either version 2 of the License, or
    8. # (at your option) any later version.
    9. #
    10. # This program is distributed in the hope that it will be useful,
    11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
    12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    13. # GNU General Public License for more details.
    14. #
    15. # You should have received a copy of the GNU General Public License
    16. # along with this program; if not, write to the Free Software
    17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    18. # Start/Stop the Zabbix server daemon.
    19. # Place a startup script in /sbin/init.d, and link to it from /sbin/rc[023].d
    20. SERVICE="Zabbix server"
    21. DAEMON=/usr/local/zabbix-3.4.2/sbin/zabbix_server
    22. PIDFILE=/tmp/zabbix_server.pid
    23. case $1 in
    24. 'start')
    25. if [ -x ${DAEMON} ]
    26. then
    27. $DAEMON
    28. # Error checking here would be good...
    29. echo "${SERVICE} started."
    30. else
    31. echo "Can't find file ${DAEMON}."
    32. echo "${SERVICE} NOT started."
    33. fi
    34. ;;
    35. 'stop')
    36. if [ -s ${PIDFILE} ]
    37. then
    38. if kill `cat ${PIDFILE}` >/dev/null 2>&1
    39. then
    40. echo "${SERVICE} terminated."
    41. rm -f ${PIDFILE}
    42. fi
    43. fi
    44. ;;
    45. 'restart')
    46. $0 stop
    47. sleep 10
    48. $0 start
    49. ;;
    50. *)
    51. echo "Usage: $0 start|stop|restart"
    52. ;;
    53. esac