#!/bin/sh

case "$1" in
    start)
	echo -n "Starting zabbix_proxy - 60s start delay for SQL server to load during boot"
	sleep 60
        sudo -u zabbix __PREFIX__/sbin/zabbix/zabbix_proxy -c __PREFIX__/etc/zabbix/zabbix_proxy.conf
        ;;

    stop)
        echo -n "Shutting down zabbix_proxy"
        pid=`ps axc|awk "{if (\\$5==\"zabbix_proxy\") print \\$1}"`
        /bin/kill $pid
       rm /var/tmp/zabbix_proxy.pid
        ;;
    restart)
        $0 stop
        $0 start
        ;;
    status)
        /bin/ps -ax |/usr/bin/grep zabbix_proxy
        ;;
        *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
esac

