#!/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

prefix=@prefix@
exec_prefix=@exec_prefix@

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

RETVAL=0

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

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

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

exit $REVAL
