Blame SOURCES/zabbix-server.init

1c3a77
#!/bin/sh
1c3a77
#
1c3a77
# chkconfig: - 85 15
1c3a77
# description: Zabbix server daemon
1c3a77
# config: /etc/zabbix/zabbix_server.conf
1c3a77
#
1c3a77
1c3a77
### BEGIN INIT INFO
1c3a77
# Provides: zabbix
1c3a77
# Required-Start: $local_fs $network
1c3a77
# Required-Stop: $local_fs $network
1c3a77
# Default-Start:
1c3a77
# Default-Stop: 0 1 2 3 4 5 6
1c3a77
# Short-Description: Start and stop Zabbix server
1c3a77
# Description: Zabbix server
1c3a77
### END INIT INFO
1c3a77
1c3a77
# Source function library.
1c3a77
. /etc/rc.d/init.d/functions
1c3a77
1c3a77
if [ -x /usr/sbin/zabbix_server ]; then
1c3a77
    exec=/usr/sbin/zabbix_server
1c3a77
else
1c3a77
    exit 5
1c3a77
fi
1c3a77
1c3a77
prog=${exec##*/}
1c3a77
conf=/etc/zabbix/zabbix_server.conf
1c3a77
pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r')
1c3a77
timeout=10
1c3a77
1c3a77
if [ -f /etc/sysconfig/zabbix-server ]; then
1c3a77
    . /etc/sysconfig/zabbix-server
1c3a77
fi
1c3a77
1c3a77
lockfile=/var/lock/subsys/zabbix-server
1c3a77
1c3a77
start()
1c3a77
{
1c3a77
    echo -n $"Starting Zabbix server: "
1c3a77
    daemon $exec -c $conf
1c3a77
    rv=$?
1c3a77
    echo
1c3a77
    [ $rv -eq 0 ] && touch $lockfile
1c3a77
    return $rv
1c3a77
}
1c3a77
1c3a77
stop()
1c3a77
{
1c3a77
    echo -n $"Shutting down Zabbix server: "
1c3a77
    killproc -p $pidfile -d $timeout $prog
1c3a77
    rv=$?
1c3a77
    echo
1c3a77
    [ $rv -eq 0 ] && rm -f $lockfile
1c3a77
    return $rv
1c3a77
}
1c3a77
1c3a77
restart()
1c3a77
{
1c3a77
    stop
1c3a77
    start
1c3a77
}
1c3a77
1c3a77
case "$1" in
1c3a77
    start|stop|restart)
1c3a77
        $1
1c3a77
        ;;
1c3a77
    force-reload)
1c3a77
        restart
1c3a77
        ;;
1c3a77
    status)
1c3a77
        status -p $pidfile $prog
1c3a77
        ;;
1c3a77
    try-restart|condrestart)
1c3a77
        if status $prog >/dev/null ; then
1c3a77
            restart
1c3a77
        fi
1c3a77
        ;;
1c3a77
    reload)
1c3a77
        action $"Service ${0##*/} does not support the reload action: " /bin/false
1c3a77
        exit 3
1c3a77
        ;;
1c3a77
    *)
1c3a77
	echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
1c3a77
	exit 2
1c3a77
	;;
1c3a77
esac
1c3a77