#!/bin/sh
#
# description: Dr.Web (R) Statistic Agent for collecting
#              and update mail statistic at stat.drweb.com
#              
# chkconfig: 2345 75 35
# processname: drweb-agent
# config: /opt/drweb/drweb_agent.conf

# Source function library.
. /etc/init.d/functions

[ -f /opt/drweb/drweb-agent ] || exit 0

RETVAL=0

start() {
	# Start daemons.
	echo -n "Starting drweb-agent: "
	daemon /opt/drweb/drweb-agent 
	RETVAL=$?
	echo
	return $RETVAL
}

reload() {
    # Reload daemons.
	killall -HUP drweb-agent
	RETVAL=$?
	return $RETVAL
}

stop() {
	# Stop daemons.
	echo -n "Shutting down drweb-agent: "
	killproc drweb-agent
	RETVAL=$?
	echo
	return $RETVAL
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  reload)
    reload
	RETVAL=$?
	;;
  status)
	status drwebd
	RETVAL=$?
	;;
  *)
	echo "Usage: drweb-agent {start|stop|reload|status}"
	exit 1
esac

exit $RETVAL

