#! /bin/sh
#
# wxbeacon:     Start APRS Weather Beacon
#
# Author:       David Norris, <dave@webaugur.com> - init script
#               Jonathan Bradshaw, <jonathan@nrgup.com> - beacon script
#
# description: WX Beacon reads Ultimeter 2000 data file and \
#              beacons packets via APRSD UDP port 1315.  \

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

[ -f /usr/local/sbin/wxbeacon ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting APRS Weather Beacon: "
	daemon /usr/local/sbin/wxbeacon
	RETVAL=$?

	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/wxbeacon
	;;
  stop)
	echo -n "Stopping APRS Weather Beacon: "
	killproc wxbeacon
	RETVAL=$?

	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/wxbeacon
	;;
  status)
	status wxbeacon
	RETVAL=$?
	;;
  restart)
  	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
	echo "Usage: wxbeacon {start|stop|status|restart}"
	exit 1
esac

exit $REVAL
