#! /bin/csh # getm2r - C Shell script to download data from OASIS mooring at M2 # and extract the data # set oasis = /oasis set can = m2r set tncaddr = "mbari-6 v mbari-2" cd $oasis/raw set noclobber set noglob set datafilebase = `date +%y%j` set failmail = "bobh@mbari.org" set i = 0 set datafile = $can.$datafilebase.00 while ( -e $datafile ) @ i++ set datafile = $can.$datafilebase.`printf "%02d" $i` end set errorfile = $oasis/$can/error/$datafile $oasis/bin/getoasis -a "$tncaddr" -c $can >& $datafile set rtnsts = $status if ( $rtnsts ) then mailx -s "Failed OASIS Download" $failmail << ! Download failure of file $datafile Return code was $rtnsts `date` ! endif if ( (-e $datafile) && !(-z $datafile) ) then $oasis/bin/extract -n -r $datafile >& $errorfile endif if ( -z $errorfile ) \ rm -f $errorfile