#! /bin/sh
# Zabbix agent start/stop script.

DAEMON=/usr/sbin/zabbix_agentd
NAME=zabbix_agentd
DESC="Zabbix agent"
PID=/var/run/zabbix-agent/$NAME.pid

test -f $DAEMON || exit 0

set -e

case "$1" in
  start)
    	rm -f $PID
	echo "Starting $DESC: $NAME"
	start-stop-daemon --oknodo --start --pidfile $PID \
		--exec $DAEMON
	;;
  stop)
	echo "Stopping $DESC: $NAME"
	start-stop-daemon --oknodo --stop --exec $DAEMON 
	;;
  restart|force-reload)
	$0 stop
	$0 start
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
