#!/bin/sh
#
# u2logger:     Start Ultimeter 2000 Weather Logger
#
# Author:       David Norris, <dave@webaugur.com> - init script
#               Jonathan Bradshaw, <jonathan@nrgup.com> - logger script
#
# description: U2Logger opens a serial port and controls the \
#              Ultimeter 2000 storing realtime weather data \
#              and keeping 5 minute logs.

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

prefix=@prefix@
exec_prefix=@exec_prefix@

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

RETVAL=0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting Ultimeter 2000 Logger: "
	daemon ${exec_prefix}/sbin/log_u2000
	RETVAL=$?

	echo
	[ $RETVAL -eq 0 ] && touch ${prefix}/log/run/log_u2000
	;;
  stop)
	echo -n "Stopping Ultimeter 2000 Logger: "
	killproc log_u2000
	RETVAL=$?

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

exit $REVAL
