# # Directories # set OASIS = /oasis set CFG = $OASIS/cfg set RAW = $OASIS/raw set BIN = $OASIS/bin set CAN = oa2 set ERROR_DIR = $OASIS/$CAN/error # # General # set FILEBASE = `date +%Y%j` # Missing Records File set RCDFILE = $RAW/oasis.rcd # Download Logs (old & new) set DLLOG = "dlinfo" set OLDLOG = "dlinfo.log" set TRUE = 1 set FALSE = 0 set noclobber set noglob # # extract Configuration # set EXTRACT = $BIN/extract2 set CFGFILE = $CFG/$CAN.cfg set EXTRACT_OPTS = "-B -r -f $RCDFILE -y 1 -c $CFGFILE" set DATAFILE = $CAN.$FILEBASE.00 set i = 0 while ( -e $RAW/$DATAFILE ) @ i++ set DATAFILE = $CAN.$FILEBASE.`printf "%02d" $i` end set ERRORFILE = $ERROR_DIR/$DATAFILE # # TNC Configuration # # TNC_PORT download from vipr radio an address:port_number. #the vipr now currently on OceanAcidification1 set TNC_CALL = 2011_OA2 #set TNC_PORT = 134.89.45.71:10000 set TNC_PORT = 134.89.45.24:20000 # # getoasis Configuration # set DOWNLOAD = $BIN/vipr #set DOWNLOAD = $BIN/touchoasis set DOWNLOAD_OPTS = " -p $TNC_PORT -c $CAN -r $RCDFILE -n 30" # # Fail Mail # set FAILMAIL = "rich@mbari.org" set ENABLE_FAILMAIL = $FALSE set MAIL_SUBJECT = "Failed OASIS Download" # oasis (Tsunami/HPUX) set MAIL = "/bin/mailx -s" set MAIL_MSG = "** message from OASIS $TNC_CALL **" ############################################# # Should not need to modify below this line # ############################################# cd $RAW # Record start of download set starttime = `date +"%x %H:%M:%S"` echo "$DOWNLOAD $DOWNLOAD_OPTS ... to... $DATAFILE" >> $OLDLOG # Download the data and record error status $DOWNLOAD $DOWNLOAD_OPTS >& $DATAFILE set rtnsts = $status # Record the end of download set endtime = `date +"%x %H:%M:%S"` # Get the raw data filesize set filesize = `ls -l $DATAFILE | sed -f $BIN/fs.sed` # Log download statistics unset noclobber echo "$DATAFILE,$starttime,$endtime,$filesize,$rtnsts" >> $DLLOG.$FILEBASE echo "$DATAFILE,$starttime,$endtime,$filesize,$rtnsts" >> $OLDLOG set noclobber # # Send failmail # if ($ENABLE_FAILMAIL == $TRUE) then if ( $rtnsts ) then $MAIL $MAIL_SUBJECT $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` $MAIL_MSG ! endif endif # Extract data if ( (-e $DATAFILE) && !(-z $DATAFILE) ) then echo "$EXTRACT $EXTRACT_OPTS $DATAFILE" >> $OLDLOG $EXTRACT $EXTRACT_OPTS $DATAFILE >& $ERRORFILE endif # Remove error file if no errors if ( -z $ERRORFILE ) then rm -f $ERRORFILE endif