#! /bin/csh # getm3 - C Shell script to download data from OASIS mooring at M3 # and extract the data # set oasis = /oasis set can = m3 set tncaddr = "mbari-7 v mbari-3" cd $oasis/raw set noclobber set noglob set datafilebase = `date +%Y%j` set failmail = "bobh@mbari.org,teto@mbari.org,zorba@mbari.org,bahr@oc.nps.navy.mil" set i = 0 set datafile = $can.$datafilebase.00 while ( -e $datafile ) @ i++ set datafile = $can.$datafilebase.`printf "%02d" $i` end $oasis/bin/getoasis -a "$tncaddr" -c $can >& $datafile set rtnsts = $status echo -n $rtnsts " " >> filelist ls -l $datafile >> filelist if ( $rtnsts ) then /bin/mailx -s "Failed OASIS Download" $failmail << ! Download failure of file $datafile Return code was $rtnsts 0 = Success 1 = Argument error (bad command line arguments) 2 = Couldn't acquire TNC port (hung download or someone's using port) 3 = Couldn't connect to OASIS (it's not listening) 4 = Download error (something broke after it connected) 5 = Abort error (somebody killed the download) `date` ! endif set errorfile = $oasis/$can/error/$datafile if ( (-e $datafile) && !(-z $datafile) ) then $oasis/bin/extract -n -r -y1 $datafile >& $errorfile endif if ( -z $errorfile ) \ rm -f $errorfile