#!/bin/sh

case "$1" in
    start)
        echo -n "Starting zabbix_agentd "
        sudo -u zabbix __PREFIX__/sbin/zabbix/zabbix_agentd -c __PREFIX__/etc/zabbix/zabbix_agentd.conf
        ;;

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

