#!/bin/sh
#
# wxbeacon:     Start Weather Underground daemon
#
# Author:       David Norris, <dave@webaugur.com> - init script and daemon
#               Jonathan Bradshaw, <jonathan@nrgup.com> - basis
#
# description: Wunderground reads Ultimeter 2000 data file and \
#              updates Weather Undeground via HTTP.  \

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

prefix=@prefix@
exec_prefix=@exec_prefix@

[ -f ${exec_prefix}/sbin/rpt_wu ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting Weather Underground Daemon: "
	daemon ${exec_prefix}/sbin/rpt_wu
	RETVAL=$?

	echo
	[ $RETVAL -eq 0 ] && touch ${prefix}/log/run/rpt_wu
	;;
  stop)
	echo -n "Stopping Weather Underground Daemon: "
	killproc rpt_wu
	RETVAL=$?

	echo
	[ $RETVAL -eq 0 ] && rm -f ${_prefix}/log/run/rpt_wu
	;;
  status)
	status rpt_wu
	RETVAL=$?
	;;
  restart)
  	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
	echo "Usage: met_rpt_wu {start|stop|status|restart}"
	exit 1
esac

exit $REVAL
