#! /bin/tcsh -f # no comments here please. comment when updating cvs #ps -fN -p $$ | grep $USER | grep $0 | grep -v grep && exit 5 # source ~cdfsoft/cdf2.cshrc setup cdfsoft2 6.1.1 #dbPing -dcdfonprd -s > /dev/null || exit 6 cd /cdf/scratch/cdfopr/cdfcalib/cdfopr/cdfcalib/cron_scripts/svx_merge @ last_date = `grep . date_runs.lst | tail -1 | awk '{print int($1)}'` # Get the last processed run number. if ( $last_date == 0 ) then # If run number is invalid. echo "file date_runs.lst:"; echo "============"; cat date_runs.lst; exit 2 # Print file, and exit. endif # if ( $last_date == 0 ) then # Find new runs with SVX calibs. $ORACLE_CLIENT_DIR/bin/sqlplus -s cdf_reader/reader@cdfonprd @runs.sql $last_date || exit 3 # Get the last SVX run. # if (! -z date_runs.lst) then # If new data-taking runs. set dat = `date` echo " Script ran at $dat " rm date.lst >& /dev/null # Clear file for safety. rm runs.lst >& /dev/null # Clear file for safety. cut -d" " -f2 date_runs.lst >! date.lst # Put the date into one list. cut -d" " -f3- date_runs.lst >! runs.lst # Put the runs in another list. # Check that all runs in list are numeric. foreach r ( `grep . runs.lst` ) # Loop over runs. @ n = 0 # Default. @ n = `echo $r | awk '{print int($1)}'` # Numeric run. if ( $n == 0 ) then # If non-numeric run translated to zero. echo "Error: Exit because of non-numeric run $r" echo "Will not process any runs." echo "file date_runs.lst:"; echo "============"; cat date_runs.lst # Print file. echo $last_date >! date_runs.lst # Put the last processed run in there. exit 4 # Exit. endif # if ( $n == 0 ) end # foreach r ( `grep . runs.txt` ) foreach r ( `grep . runs.lst` ) # Loop over runs. echo DBSetMerge TESTMODE OTL /@cdfonprd used $r PROD_PHYSICS_CDF PROD_PHYSICS_CDF PROD_PHYSICS_SVX DBSetMerge TESTMODE OTL /@cdfonprd used $r PROD_PHYSICS_CDF PROD_PHYSICS_CDF PROD_PHYSICS_SVX echo DBSetMerge OTL /@cdfonprd used $r PROD_PHYSICS_CDF PROD_PHYSICS_CDF PROD_PHYSICS_SVX DBSetMerge OTL /@cdfonprd used $r PROD_PHYSICS_CDF PROD_PHYSICS_CDF PROD_PHYSICS_SVX end # foreach r ( `grep . runs.lst` ) echo "==============================end run====================================" else # No new runs detected. echo $last_date >> date_runs.lst # Put the last processed run in there. endif # if (-z date_runs.lst) then rm core >& /dev/null # Remove core file, if it exists.