#!/bin/csh
#
# Deal with existing satellite files.
#
#
# Start by trying to make sure that zeb is up.  We do that by looking for
# the socket file.
#
test -f /tmp/fcc.socket || exit
#
# Make sure only one of these guys runs at once.
#
test -f /tmp/proc-gms-lock && exit
touch /tmp/proc-gms-lock
#
# Look for hi res files.
#
set nonomatch
foreach file (/zeb/coare/sat-spool/gms*)
	echo $file
	test -r $file || continue
	/zeb/bin/GMSIngest <<END-SAT
		limits -10 145 5 170
		set originLat -9.42
		set platform "gms"
		file $file ir
		set kmResolution 4
		go
END-SAT
	rm -f $file
end
#
# Do the low res data too.
#
foreach file (/zeb/coare/sat-spool/big-gms*)
	echo $file
	test -r $file || continue
	/zeb/bin/GMSIngest <<END-SAT
		limits -30 130 10 179
		set originLat -9.42
		set platform "gms-big"
		file $file ir
		set kmResolution 8
		go
END-SAT
	rm -f $file
end

rm /tmp/proc-gms-lock
