#!/bin/csh -f
#
# number of minutes per cycle
set REPEAT=15
# number of minutes past the o'clock to start cycles
set OFFSET=2
if (! -e ~/.wxmaprc) then
	echo "root on" >> ~/.wxmaprc
	echo "map" >> ~/.wxmaprc
	echo "quit" >> ~/.wxmaprc
endif
while (1)
	set PSLINE = `/bin/ps -lp $$ | grep $$`
	if ($#PSLINE < 5) then
		echo "$PSLINE" | /usr/ucb/mail -s "erroneous cwxmap psline" watrous@cs
	endif
	if ($PSLINE[5] == "1") exit
	/usr/local/bin/wxmap $* -file ~/.wxmaprc >&/tmp/cwxmap.$$
	@ SLEEP = ($REPEAT + $OFFSET - (`date +%M` % $REPEAT)) * 60
	sleep $SLEEP
end
