#!/bin/sh
#
# syssumm       This shell script runs syssumm on during the system start
#
# chkconfig: 345 98 02
# description: syssumm sends back a system report to a web server
# probe: true

SYSSUMM_DIR=/usr/local/lib/syssumm
SYSSUMM=$SYSSUMM_DIR/syssumm.pl

[ -f $SYSSUMM ] || exit 0

MAILADDR="syssumm@charm.ansto.gov.au"
TMPFILE=/var/run/syssumm.out
[ \( -f $TMPFILE -a -w $TMPFILE \) \
	-o \( ! -f $TMPFILE -a -w `dirname $TMPFILE` \) ] \
		|| TMPFILE=/tmp/syssumm.out

case "$1" in
	start)
		# Run syssumm.pl
		echo -n "Running syssumm: (in background)"
		$SYSSUMM -m $MAILADDR -f $TMPFILE &
		echo "."
		;;
	stop)
		;;
	restart|reload)
		$0 start
		;;
	status)
		echo "No status available for this package"
		exit 0
		;;
	*)
		echo "Usage: syssumm {start|stop|restart|reload|status}"
		exit 1
esac

exit 0
