Changeset 8482 for trunk/MagicSoft/Mars/datacenter/scripts
- Timestamp:
- 05/09/07 17:05:15 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/datacenter/scripts
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries
r7954 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 32 32 # macro buildsequenceentries.C 33 33 # If this was successful, the status is inserted into the database using 34 # the macro setstatus.C34 # the function setstatus. 35 35 # 36 36 … … 69 69 printprocesslog "INFO build sequence entries for $date" 70 70 year2=`echo $date | cut -c 1-4` 71 var1=$year272 var2=$date73 71 buildsequentriespath=$logpath/$program/$year2 74 72 makedir $buildsequentriespath >> $scriptlog 2>&1 75 73 buildsequentrieslog=$buildsequentriespath/buildsequenceentries-$date.log 76 74 75 primvar=$date 77 76 setstatus "start" >> $scriptlog 2>&1 78 77 -
trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail
r7982 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 32 32 # checked by using the macro checkfilesavail.C 33 33 # If this was successful, the status is inserted into the database using 34 # the macro setstatus.C34 # the function setstatus. 35 35 # 36 36 … … 68 68 no=`printf %08d $sequence | cut -c 0-4` 69 69 no2=`printf %08d $sequence` 70 var1=$no71 var2=$no272 70 checkfileavailpath=$logpath/$program/$no 73 71 makedir $checkfileavailpath >> $scriptlog 2>&1 … … 76 74 sequencefile=$sequpath/$no/sequence$no2.txt 77 75 76 primvar=$no2 78 77 setstatus "start" >> $scriptlog 2>&1 79 78 -
trunk/MagicSoft/Mars/datacenter/scripts/checklogs
r8058 r8482 20 20 # Author(s): Daniela Dorner 08/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/checkstardone
r7954 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 33 33 # the macro checkstardone.C 34 34 # If this was successful, the status is inserted into the database using 35 # the macro setstatus.C35 # the function setstatus. 36 36 # 37 37 … … 68 68 no=`printf %08d $dataset | cut -c 0-5` 69 69 no2=`printf %08d $dataset` 70 var1=$no71 var2=$dataset72 70 datasetfile=$datasetpath/$no/dataset`printf %08d $dataset`.txt 73 71 … … 84 82 makedir $outpath >> $scriptlog 2>&1 85 83 84 primvar=$dataset 86 85 setstatus "start" >> $scriptlog 2>&1 87 86 -
trunk/MagicSoft/Mars/datacenter/scripts/checktransfer
r8232 r8482 20 20 # Author(s): Daniela Dorner 09/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/copyscript
r8469 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 99 99 100 100 #find all dates in transfer-directory 101 dates=`find $transdir/*/ -type d | grep -o --regexp=20[0-9][0-9]_[0-1][0-9]_[0-3][0-9] ` >> $scriptlog 2>&1101 dates=`find $transdir/*/ -type d | grep -o --regexp=20[0-9][0-9]_[0-1][0-9]_[0-3][0-9] | sort | uniq` >> $scriptlog 2>&1 102 102 if ! [ "$dates" = "" ] 103 103 then … … 220 220 do 221 221 printprocesslog "INFO process "$opticalfile 222 # echo $opticalfile223 222 file=`basename $opticalfile` 224 223 year=`echo $file | cut -c 0-4` … … 226 225 makedir $opticallogpath >> $scriptlog 2>&1 227 226 opticallogfile=$opticallogpath/filloptical-$file.log 228 # echo "logfile: "$opticallogfile229 227 230 228 checkfilloptical=`root -q -b $macrospath/filloptical.C+\("\"$opticalfile\""\,kFALSE\) | tee $opticallogfile | intgrep` 231 # checkfilloptical=`root -q -b $macrospath/filloptical.C+\("\"$opticalfile\""\) | tee $opticallogfile | intgrep`232 229 233 230 case $checkfilloptical in … … 266 263 267 264 #getting new catalogfiles 268 catfiles=`find $subsystempath/cc/ -name $magfav -newer $catalog | sort` 265 for (( i=0 ; i < 31 ; i++ )) 266 do 267 date=`date --date "-${i}day" +%Y/%m/%d` 268 path=$subsystempath/cc/$date 269 catfiles=$catfiles" "`find $path -name $magfav -newer $catalog` 270 done 269 271 270 272 for catfile in ${catfiles[@]} -
trunk/MagicSoft/Mars/datacenter/scripts/correcttime
r7944 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 31 31 # Then for each run the timing correction is done 32 32 # If this was successful, the status is inserted into the database using 33 # the macro setstatus.C33 # the function setstatus. 34 34 # 35 35 # This script was needed for the data between 06/2004 and 02/2005 (including … … 69 69 printprocesslog "INFO run correct_raw_time for run $run" 70 70 no=`printf %08d $run | cut -c 1-5` 71 var1=$no72 var2=$run73 71 echo "getting path for run $run ... " >> $scriptlog 2>&1 74 infile=`find $datapath/rawfiles-wrong-timing/ -name *${run}_[D ,C,P,S]_*`72 infile=`find $datapath/rawfiles-wrong-timing/ -name *${run}_[DCPS]_*` 75 73 echo "infile:"$infile >> $scriptlog 2>&1 76 74 outfile=`echo $infile | sed -e 's/-wrong-timing//g'` … … 86 84 check1=0 87 85 echo "run $program..." >> $scriptlog 2>&1 86 primvar=$run 88 87 setstatus "start" >> $scriptlog 2>&1 89 88 -
trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck
r7954 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 36 36 # taken into account when doexclusions is running the next time 37 37 # If this was successful, the status is inserted into the database using 38 # the macro setstatus.C38 # the function setstatus. 39 39 # 40 40 … … 63 63 no=`printf %08d $run | cut -c 0-2` 64 64 no2=`printf %08d $run` 65 var1=$date 66 var2=$no2 67 rawfile=`find /magic/data/rawfiles/ -name *${run}_[D,P,C,S]_*_E.raw -o -name *${run}_[D,P,C,S]_*_E.raw.gz`65 query="SELECT DATE_FORMAT(ADDDATE(fRunStart, INTERVAL +13 HOUR), '%Y/%m/%d') FROM RunData where fRunNumber="$run 66 date=`sendquery` 67 rawfile=`find /magic/data/rawfiles/$date -name *${run}_[D,P,C,S]_*_E.raw -o -name *${run}_[DPCS]_*_E.raw.gz` 68 68 echo "rawfile: "$rawfile >> $scriptlog 2>&1 69 date=`echo $rawfile | cut -c 22-31`70 69 # for sinope the date is needed in the format YYYY-MM-DD 71 70 date2=`echo $date | sed -e 's/\//-/g'` 72 71 72 primvar=$no2 73 73 setstatus "start" >> $scriptlog 2>&1 74 74 … … 113 113 114 114 case $check2 in 115 116 117 118 119 120 # 121 122 123 115 0) echo " check2=$check2 -> everything ok -> go on with $program..." >> $scriptlog 2>&1 116 ;; 117 *) echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1 118 printprocesslog "ERROR sinope $sin failed for $rawfile" 119 com=$Fsinope 120 # comadd= 121 check=$check2 122 setstatus "stop" >> $scriptlog 2>&1 123 continue 2;; 124 124 esac 125 125 check2=1 … … 182 182 starttime="NULL" 183 183 failedtime="NULL" 184 var1=$date185 var2=$no2186 184 setstatus "stop" >> $scriptlog 2>&1 187 185 -
trunk/MagicSoft/Mars/datacenter/scripts/doexclusions
r7954 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 32 32 # macro doexclusions.C 33 33 # If this was successful, the status is inserted into the database using 34 # the macro setstatus.C34 # the function setstatus. 35 35 # 36 36 … … 69 69 printprocesslog "INFO do exclusions for $date" 70 70 year2=`echo $date | cut -c 1-4` 71 var1=$year272 var2=$date73 71 doexclusionspath=$logpath/$program/$year2 74 72 makedir $doexclusionspath >> $scriptlog 2>&1 75 73 doexclusionslog=$doexclusionspath/doexclusions-$date.log 76 74 75 primvar=$date 77 76 setstatus "start" >> $scriptlog 2>&1 78 77 -
trunk/MagicSoft/Mars/datacenter/scripts/doqualityplots
r8465 r8482 20 20 # Author(s): Daniela Dorner 08/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 54 54 55 55 case $check0 in 56 57 58 59 60 61 62 56 1) echo " check0=$check0 -> everything ok -> move files" >> $scriptlog 2>&1 57 printprocesslog "INFO plots successfully produced" 58 ;; 59 *) echo " check0=$check0 -> ERROR -> couldn't create plots -> exit" >> $scriptlog 2>&1 60 printprocesslog "ERROR producing plots failed" 61 finish >> $scriptlog 2>&1 62 ;; 63 63 esac 64 64 -
trunk/MagicSoft/Mars/datacenter/scripts/dowebplots
r8465 r8482 20 20 # Author(s): Daniela Dorner 08/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 44 44 do 45 45 case $opts in 46 p) type=$OPTARG47 echo "got programname: $type" >> $scriptlog 2>&148 ;;49 ?) echo "usage: $(basename $0) -p programname" >> $scriptlog 2>&150 ;;46 p) type=$OPTARG 47 echo "got programname: $type" >> $scriptlog 2>&1 48 ;; 49 ?) echo "usage: $(basename $0) -p programname" >> $scriptlog 2>&1 50 ;; 51 51 esac 52 52 done -
trunk/MagicSoft/Mars/datacenter/scripts/filesondisk
r8410 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 33 33 # this includes also the search for missing cacofiles: 34 34 # Sometimes the DAQ aborts a run and starts itself a new one. In this 35 # cases the camera control ldoesn't start a new file, as the command to35 # cases the camera control doesn't start a new file, as the command to 36 36 # start a new run was not sent by the central control. So the caco 37 37 # information is stored in the previous caco file, which has a … … 40 40 # information has to be found. 41 41 # In this script the search and inserting into the database is done 42 # using the macro s findcacofiles.C and insertcacofile.C42 # using the macro findcacofiles.C 43 43 # - rawfiles 44 44 # The update in the database is done using the macro resetallruns.C … … 66 66 printprocesslog "INFO checking ccfiles" 67 67 filename=$filesondisklogpath/ccfilesondisk-$datetime.txt 68 if ls $filename >/dev/null 2>&1 69 then 70 rm -v $filename >> $scriptlog 2>&1 71 fi 68 72 column=fCCFileAvail 69 73 find $subsystempath/cc/ -name '*_S.rep' | cut -d_ -f2 > $filename … … 85 89 86 90 91 87 92 echo "checking disk for cacofiles..." >> $scriptlog 2>&1 88 93 printprocesslog "INFO checking cacofiles" 89 94 filename=$filesondisklogpath/cacofilesondisk-$datetime.txt 95 if ls $filename >/dev/null 2>&1 96 then 97 rm -v $filename >> $scriptlog 2>&1 98 fi 90 99 column=fCaCoFileAvail 91 100 find $subsystempath/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename … … 107 116 108 117 date=`date +%F` 109 echo " checking missing cacofiles..." >> $scriptlog 2>&1118 echo "finding missing cacofiles..." >> $scriptlog 2>&1 110 119 printprocesslog "INFO checking missing cacofiles" 111 check1=`root -q -b $macrospath/findcacofiles.C+ \("\"$date\""\,"\"$filesondisklogpath\""\)| tee $filesondisklogpath/findcacofiles-$datetime.log | intgrep`120 check1=`root -q -b $macrospath/findcacofiles.C+ | tee $filesondisklogpath/findcacofiles-$datetime.log | intgrep` 112 121 113 122 case $check1 in … … 123 132 esac 124 133 125 printprocesslog "INFO finding missing cacofiles"126 missingcacoruns=(`cat $filesondisklogpath/findcacofiles-$date.txt`)127 for missingcacorun in ${missingcacoruns[@]}128 do129 runno=$missingcacorun130 echo "missing cacofile for run "$runno >> $scriptlog 2>&1131 echo "-> finding cacofile" >> $scriptlog 2>&1132 ccfile=`find $subsystempath/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep -and ! -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*[1-9]${runno}_[P,D,C,S]_*_S.rep` 2>/dev/null133 echo " ccfile: "$ccfile >> $scriptlog 2>&1134 if [ "$ccfile" = "" ]135 then136 echo " no ccfile found for run "$runno >> $scriptlog 2>&1137 continue138 fi139 for (( i = 0; i <= 10; i++ ))140 do141 newrun=`echo $runno - $i | bc`142 path=`dirname $ccfile`143 path=`echo $path | sed -e 's/cc/caco/'`144 cacofile=`find $path -name *$newrun* 2>/dev/null`145 if [ "$cacofile" = "" ]146 then147 continue148 else149 printprocesslog "INFO inserting cacofile for run $missingcacorun"150 echo " inserting cacofile $file for run $missingcacorun..." >> $scriptlog 2>&1151 check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | intgrep`152 153 case $check2 in154 1) echo " check2=$check2 -> everything ok -> insert is done" >> $scriptlog 2>&1155 printprocesslog "INFO inserted $missingcacorun successfully"156 ;;157 0) echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1158 printprocesslog "WARN connection to DB failed"159 ;;160 *) echo " check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun >> $scriptlog 2>&1161 printprocesslog "ERROR insertcacofile.C failed for run $missingcacorun"162 ;;163 esac164 break165 fi166 done167 if [ "$cacofile" = "" ]168 then169 echo " no cacofile found for run "$runno >> $scriptlog 2>&1170 printprocesslog "WARN no cacofile found for run $runno"171 else172 echo " cacofile: "$cacofile >> $scriptlog 2>&1173 fi174 done175 134 176 135 … … 178 137 printprocesslog "INFO checking rawfiles" 179 138 filename=$filesondisklogpath/rawfilesondisk-$datetime.txt 139 if ls $filename >/dev/null 2>&1 140 then 141 rm -v $filename >> $scriptlog 2>&1 142 fi 180 143 column=fRawFileAvail 181 144 find $datapath/rawfiles -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename -
trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto
r7954 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 33 33 # fillcalib.C and fillsignal.C 34 34 # If this was successful, the status is inserted into the database using 35 # the macro setstatus.C35 # the function setstatus. 36 36 # 37 37 … … 70 70 no=`printf %08d $sequence | cut -c 0-4` 71 71 no2=`printf %08d $sequence` 72 var1=$no73 var2=$no274 72 path="$datapath/callisto/$no/$no2" 75 73 signalfile=$path/signal$no2.root … … 81 79 82 80 echo "run $program for sequence $sequence" >> $scriptlog 2>&1 81 primvar=$no2 83 82 setstatus "start" >> $scriptlog 2>&1 84 83 echo "run fillcalib..." >> $scriptlog 2>&1 -
trunk/MagicSoft/Mars/datacenter/scripts/fillganymed
r7954 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 32 32 # into the table Ganymed in the database using the macro fillganymed.C 33 33 # If this was successful, the status is inserted into the database using 34 # the macro setstatus.C34 # the function setstatus. 35 35 # 36 36 … … 70 70 no=`printf %08d $dataset | cut -c 0-5` 71 71 no2=`printf %08d $dataset` 72 var1=$no73 var2=$no274 72 path="$datapath/ganymed/$no/$no2" 75 73 ganymedfile=$path/ganymed$no2.root … … 79 77 80 78 echo "run $program for dataset $dataset" >> $scriptlog 2>&1 79 primvar=$no2 81 80 setstatus "start" >> $scriptlog 2>&1 82 81 -
trunk/MagicSoft/Mars/datacenter/scripts/fillstar
r7954 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 32 32 # into the table Star in the database using the macro fillstar.C 33 33 # If this was successful, the status is inserted into the database using 34 # the macro setstatus.C34 # the function setstatus. 35 35 # 36 36 … … 70 70 no=`printf %08d $sequence | cut -c 0-4` 71 71 no2=`printf %08d $sequence` 72 var1=$no73 var2=$no274 72 path="$datapath/star/$no/$no2" 75 73 starfile=$path/star$no2.root … … 79 77 80 78 echo "run $program for sequence $sequence" >> $scriptlog 2>&1 79 primvar=$no2 81 80 setstatus "start" >> $scriptlog 2>&1 82 81 -
trunk/MagicSoft/Mars/datacenter/scripts/findnewstars
r8380 r8482 20 20 # Author(s): Daniela Dorner 10/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/findnotseqruns
r8380 r8482 20 20 # Author(s): Daniela Dorner 10/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets
r7961 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/insertsequences
r7954 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/jobmanager
r8461 r8482 20 20 # Author(s): Daniela Dorner 05/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 142 142 echo "condor is not working -> sleeping $errorsleeptime" >> $jmscriptlog 2>&1 143 143 printprocesslog "WARN submitting ${scripts[$i]} to condor failed" 144 if [ $errorsleeptime -lt $sleeptimelimit ] 145 then 146 errorsleeptime=`echo " $errorsleeptime + $errorsleeptimedefault " | bc` 147 fi 144 148 sleep $errorsleeptime 149 else 150 errorsleeptime=$errorsleeptimedefault 145 151 fi 146 152 date >> $jmscriptlog 2>&1 -
trunk/MagicSoft/Mars/datacenter/scripts/linkmc
r8433 r8482 20 20 # Author(s): Daniela Dorner 12/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 149 149 for (( i=1 ; i <= 12 ; i++ )) 150 150 do 151 152 153 154 155 151 if [ "${modes[$i]}" == "$testmode" ] 152 then 153 totalmode=$i 154 break 155 fi 156 156 done 157 157 -
trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks
r8410 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/mcsequences
r8437 r8482 20 20 # Author(s): Daniela Dorner 12/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/movingsubsystemfiles
r7460 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 45 45 for subsysfile in ${subsysfiles[@]} 46 46 do 47 newsubsysfile=`echo $subsysfile | sed -e 's/datacenter\/fromtape/subsystemdata/g' -e 's/daqlog/daq__/g' -e 's/ccdata/cc/g' -e 's/cacodata/caco/g' -e 's/_/\//1' -e 's/_/\//1' -e 's/\/\///g'`48 newdir=`dirname $newsubsysfile`49 if [ ! -d $newdir ]50 then51 echo "make dir "$newdir52 mkdir -p $newdir53 fi47 newsubsysfile=`echo $subsysfile | sed -e 's/datacenter\/fromtape/subsystemdata/g' -e 's/daqlog/daq__/g' -e 's/ccdata/cc/g' -e 's/cacodata/caco/g' -e 's/_/\//1' -e 's/_/\//1' -e 's/\/\///g'` 48 newdir=`dirname $newsubsysfile` 49 if [ ! -d $newdir ] 50 then 51 echo "make dir "$newdir 52 mkdir -p $newdir 53 fi 54 54 55 mv -v $subsysfile $newsubsysfile55 mv -v $subsysfile $newsubsysfile 56 56 done 57 57 -
trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences
r8080 r8482 20 20 # Author(s): Daniela Dorner 12/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/rmlocks
r8007 r8482 20 20 # Author(s): Daniela Dorner 08/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/runcallisto
r8454 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 51 51 sequence=$process 52 52 53 # lock sequ 53 # lock sequ for cal 54 54 lockfile=$lockpath/lock-$table-$column-$sequence.txt 55 55 checklock >> $scriptlog 2>&1 … … 62 62 no=`printf %08d $sequence | cut -c 0-4` 63 63 no2=`printf %08d $sequence` 64 var1=$no65 var2=$no266 64 outpath="$datapath/$program/$no/$no2" 67 65 makedir $outpath >> $scriptlog 2>&1 … … 80 78 if [ $sequence -gt 200000 ] 81 79 then 82 80 ln -vs $callistorcmux $outpath/callisto.rc >> $scriptlog 2>&1 83 81 else 84 82 ln -vs $callistorcnew $outpath/callisto.rc >> $scriptlog 2>&1 85 83 fi 86 84 callistorcseq=$outpath/callisto.rc 87 85 fi 88 86 87 # lock sequ for zipping 88 lockfile=$lockpath/calzip$sequence.txt 89 # if lockfile is already existing, 1 is returned 90 if ! checklock return 1 >> $scriptlog 2>&1 91 then 92 # reset lockfile name 93 lockfile=$lockpath/lock-$table-$column-$sequence.txt 94 finish >> $scriptlog 2>&1 95 fi 96 97 primvar=$no2 89 98 setstatus "start" >> $scriptlog 2>&1 90 99 … … 92 101 ./callisto -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath --config=$callistorcseq $sequfile 2>> $scriptlog > /dev/null 93 102 check1=$? 103 104 # remove lockfile for zip and reset lockfile name 105 rm -v $lockfile >> $scriptlog 2>&1 106 lockfile=$lockpath/lock-$table-$column-$sequence.txt 94 107 95 108 case $check1 in … … 117 130 # find cc and caco file 118 131 # if file is missing continue with next sequence 132 date=`date --date \`basename $calfile | cut -d_ -f1 +%Y/%m/%d\`` 133 ccpath=$subsystempath/cc/$date 134 cacopath=$subsystempath/caco/$date 119 135 runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' ` 120 ccfile=`find /magic/subsystemdata/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep -and ! -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*[1-9]${runno}_[P,D,C,S]_*_S.rep`136 ccfile=`find $ccpath -name 20[0-2][0-9][01][0-9][0-3][0-9]_*${runno}_[PDCS]_*_S.rep` 121 137 source=`echo $ccfile | cut -d_ -f4` 122 cacofile=`find /magic/subsystemdata/caco/ -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*${runno}_${source}.txt -and ! -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*[1-9]${runno}_${source}.txt` 123 # cacofile=`find /magic/subsystemdata/caco/ -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*${runno}_*.txt` 138 cacofile=`find /magic/subsystemdata/caco/$date -name dc_20[0-2][0-9]_[01][0-9]_[0-3][0-9]_*${runno}_${source}.txt` 124 139 if [ "$ccfile" = "" ] 125 140 then … … 138 153 do 139 154 newrun=`echo $runno - $i | bc` 140 path=`dirname $ccfile` 141 path=`echo $path | sed -e 's/cc/caco/'` 142 echo "path: "$path >> $scriptlog 2>&1 143 cacofile=`find $path -name *$newrun*` 155 cacofile=`find $cacopath -name *$newrun*` 144 156 if [ "$cacofile" = "" ] 145 157 then 146 158 if [ $i -eq 9 ] 147 159 then 148 echo "no cacofile found " >> $scriptlog 2>&1160 echo "no cacofile found for runno $newrun in $cacopath" >> $scriptlog 2>&1 149 161 printprocesslog "ERROR cacofile $cacofile not found for $calfile" 150 162 com=$Fnocacofile … … 164 176 check2=$? 165 177 case $check2 in 166 167 168 169 170 171 172 173 174 178 0) echo " check2=$check2 -> everything ok, merppccupdate worked -> continue" >> $scriptlog 2>&1 179 printprocesslog "INFO merppupdated $calfile sucessfully with $ccfile" 180 ;; 181 *) echo " check2=$check2 -> ERROR -> merppccupdate failed" >> $scriptlog 2>&1 182 printprocesslog "ERROR merppccupdate with file $ccfile failed for $calfile" 183 com=$Fmerppcc 184 comadd=$runno 185 check=$check2 186 break ;; 175 187 esac 176 188 echo "./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --html=$merpplogpath/merppcacoupdate$runno.html --auto-time $cacofile $calfile 2>> $scriptlog> /dev/null" >> $scriptlog 2>&1 … … 178 190 check3=$? 179 191 case $check3 in 180 181 182 183 184 185 186 187 188 192 0) echo " check3=$check3 -> everything ok, merppcacoupdate worked -> continue" >> $scriptlog 2>&1 193 printprocesslog "INFO merppupdated $calfile sucessfully with $cacofile" 194 ;; 195 *) echo " check3=$check3 -> ERROR -> merppcacoupdate failed" >> $scriptlog 2>&1 196 printprocesslog "ERROR merppcacoupdate with file $cacofile failed for $calfile" 197 com=$Fmerppcaco 198 comadd=$runno 199 check=$check3 200 break ;; 189 201 esac 190 202 done -
trunk/MagicSoft/Mars/datacenter/scripts/runganymed
r8433 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 61 61 no=`printf %08d $dataset | cut -c 0-5` 62 62 no2=`printf %08d $dataset` 63 var1=$no64 var2=$no265 63 outpath="$datapath/$program/$no/$no2" 66 64 makedir $outpath >> $scriptlog 2>&1 … … 75 73 fi 76 74 75 primvar=$no2 77 76 setstatus "start" >> $scriptlog 2>&1 78 77 -
trunk/MagicSoft/Mars/datacenter/scripts/runstar
r8176 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 61 61 no=`printf %08d $sequence | cut -c 0-4` 62 62 no2=`printf %08d $sequence` 63 var1=$no64 var2=$no265 63 outpath="$datapath/$program/$no/$no2" 66 64 inpath=`echo $outpath | sed -e 's/star/callisto/'` … … 69 67 sequfile="$sequpath/$no/sequence$no2.txt" 70 68 69 primvar=$no2 71 70 setstatus "start" >> $scriptlog 2>&1 72 71 -
trunk/MagicSoft/Mars/datacenter/scripts/scriptlauncher
r8462 r8482 20 20 # Author(s): Daniela Dorner 08/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 37 37 scriptlog=$runlogpath/scriptlauncher`date +%F`.log 38 38 39 echo `date`": starting $0 $@" 39 echo `date`": starting $0 $@" >> $scriptlog 2>&1 40 40 41 41 path=`dirname $0` 42 42 date=`date +%Y-%m-%d` 43 43 44 for i in $@ 44 scripts=( `echo $@ | sed -e 's/allatthesametime//'` ) 45 num=${#scripts[@]} 46 echo "$num scripts have to be launched" >> $scriptlog 2>&1 47 i=0 48 49 while [ $i -lt $num ] 45 50 do 46 if [ "$i" = "allatthesametime" ] 47 then 48 continue 49 fi 50 echo " launching $i..." >> $scriptlog 2>&1 51 pid=`/usr/local/bin/condor_submit -a path=$path -a prog=$i -a date=$date -a dir=$runlogpath $path/run.condor 2>> $errorlog | grep 'submitted to cluster' | cut -dr -f2` 51 echo " launching ${scripts[$i]}..." >> $scriptlog 2>&1 52 pid=`/usr/local/bin/condor_submit -a path=$path -a prog=${scripts[$i]} -a date=$date -a dir=$runlogpath $path/run.condor 2>> $errorlog | grep 'submitted to cluster' | cut -dr -f2` 52 53 if [ "$pid" = "" ] 53 54 then 54 55 echo `date`" WARN condor is not working " >> $errorlog 2>&1 55 printprocesslog "WARN submitting $i to condor failed" 56 printprocesslog "WARN submitting ${scripts[$i]} to condor failed" 57 continue 56 58 fi 57 59 if ! echo $@ | grep "allatthesametime" >/dev/null 2>$errorlog 58 60 then 59 echo " waiting for $ ito be done..." >> $scriptlog 2>&161 echo " waiting for ${scripts[$i]} to be done..." >> $scriptlog 2>&1 60 62 /usr/local/bin/condor_wait $runlogpath/condor-$date.log $pid >/dev/null 2>$errorlog 61 63 fi 64 i=`expr $i + 1` 62 65 done 63 66 echo `date`": all done/submitted." >> $scriptlog 2>&1 -
trunk/MagicSoft/Mars/datacenter/scripts/setup
r8167 r8482 20 20 # Author(s): Daniela Dorner 05/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 63 63 sleeptime=30 #30 64 64 sleeptimelimit=360 #360 65 errorsleeptime =60 #6065 errorsleeptimedefault=60 #60 66 66 max=18 #maximum number of processes 67 67 -
trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
r8400 r8482 20 20 # Author(s): Daniela Dorner 05/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 47 47 if [ ! -d $@ ] 48 48 then 49 mkdir -pv $@50 if [ ! -d $@ ]51 then52 echo "could not make dir "$@53 rm -v $todofile54 rm -v $lockfile55 date56 exit57 fi49 mkdir -pv $@ 50 if [ ! -d $@ ] 51 then 52 echo "could not make dir "$@ 53 rm -v $todofile 54 rm -v $lockfile 55 date 56 exit 57 fi 58 58 fi 59 59 } … … 133 133 function finish() 134 134 { 135 if ls $todofile >/dev/null 2>&1135 if ! [ "$todofile" = "" ] && ls $todofile >/dev/null 2>&1 136 136 then 137 137 rm -v $todofile … … 160 160 checklock0=$? 161 161 case $checklock0 in 162 0) echo " checklock0=$checklock0 -> continue " ;; 163 1) echo " checklock0=$checklock0 -> file $lockfile exists -> exit" 164 date 165 exit;; 166 *) echo " checklock0=$checklock0 -> something went completely wrong" ;; 162 0) echo " checklock0=$checklock0 -> continue " ;; 163 1) echo " checklock0=$checklock0 -> file $lockfile exists" 164 date 165 $@ 166 exit;; 167 *) echo " checklock0=$checklock0 -> something went completely wrong" ;; 167 168 esac 168 }169 170 # function calling the macro, which is producing the todo-list171 function getdolistroot()172 {173 datetime=`date +%F-%H-%M-%S`174 year=`date +%Y`175 date=NULL176 177 getstatuslogpath=$logpath/getstatus/$program/$year178 getstatuslog=$getstatuslogpath/getstatus-$table-$column-$datetime.log179 makedir $getstatuslogpath180 181 # get todo list182 echo "getting todo list..."183 check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`184 185 case $check0 in186 1) echo " check0=$check0 -> everything ok, got todo list -> run $program";;187 *) echo " check0=$check0 -> ERROR -> could not get todo list -> exit"188 finish ;;189 esac190 191 169 } 192 170 … … 222 200 ;; 223 201 stop) case $check in 224 ok) echo "setstatus stop - ok"225 statustime="Now()"226 ;;227 no) echo "setstatus stop - nothing new"228 check="ok"229 ;;230 *) echo "setstatus stop - failed"231 starttime=noreset232 if [ "$check" == "" ]233 then234 returncode=1235 else236 returncode=$check237 fi238 failedcode=$com239 if ! [ "$comadd" = "" ]240 then241 failedcodeadd=$comadd242 fi243 failedtime="Now()"244 check="ok"245 ;;202 ok) echo "setstatus stop - ok" 203 statustime="Now()" 204 ;; 205 no) echo "setstatus stop - nothing new" 206 check="ok" 207 ;; 208 *) echo "setstatus stop - failed" 209 starttime=noreset 210 if [ "$check" == "" ] 211 then 212 returncode=1 213 else 214 returncode=$check 215 fi 216 failedcode=$com 217 if ! [ "$comadd" = "" ] 218 then 219 failedcodeadd=$comadd 220 fi 221 failedtime="Now()" 222 check="ok" 223 ;; 246 224 esac 247 225 ;; … … 250 228 finish 251 229 ;; 252 esac253 }254 255 # function calling the macro to set the status, after a process has finished256 function setstatusroot()257 {258 # set status values259 resetstatusvalues260 evalstatus $@261 262 # printstatusvalues263 # set status264 setstatuslogpath=$logpath/setstatus/$program/$var1265 makedir $setstatuslogpath266 setstatuslog=$setstatuslogpath/setstatus-$@-$program-$var2.log267 checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$var2\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$returncode\""\,"\"$failedcode\""\,"\"$failedcodeadd\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`268 case $checkstatus in269 1) echo " checkstatus=$checkstatus -> everything ok, status has been set";;270 *) echo " checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"271 finish ;;272 230 esac 273 231 } … … 417 375 if [ "$reset" = "no" ] 418 376 then 419 echo "YOU CAN'T RESET $column for $ var2!!!"420 printprocesslog "ERROR you can't reset $column for $ var2"377 echo "YOU CAN'T RESET $column for $primvar!!!" 378 printprocesslog "ERROR you can't reset $column for $primvar" 421 379 finish 422 380 fi … … 434 392 fi 435 393 query=$query", fFailedTime=$failedtime, fFailedCode=$failedcode, fFailedCodeAdd=$failedcodeadd, fReturnCode=$returncode " 436 query=$query" where $primary='$ var2'"394 query=$query" where $primary='$primvar'" 437 395 echo " QUERY: "$query 438 396 if ! mysql -s -u $us --password=$pw --host=vela $db -e " $query " … … 445 403 } 446 404 405 # function to send a mysql query 406 function sendquery() 407 { 408 getdbsetup 409 if ! val=`mysql -s -u $us --password=$pw --host=vela $db -e " $query "` 410 then 411 printprocesslog "ERROR could not query db (program: $program, function sendquery)" 412 return 1 413 fi 414 if [ "$val" = "NULL" ] 415 then 416 val= 417 fi 418 echo $val 419 return 0 420 } 421 -
trunk/MagicSoft/Mars/datacenter/scripts/webupdate-callisto
r7944 r8482 20 20 # Author(s): Daniela Dorner 08/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/webupdate-ganymed
r7944 r8482 18 18 # 19 19 # 20 # Author(s): Daniela Dorner 08/200 4<mailto:dorner@astro.uni-wuerzburg.de>20 # Author(s): Daniela Dorner 08/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 422 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/webupdate-sinope
r7944 r8482 18 18 # 19 19 # 20 # Author(s): Daniela Dorner 08/200 4<mailto:dorner@astro.uni-wuerzburg.de>20 # Author(s): Daniela Dorner 08/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 422 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/webupdate-star
r7944 r8482 18 18 # 19 19 # 20 # Author(s): Daniela Dorner 08/200 4<mailto:dorner@astro.uni-wuerzburg.de>20 # Author(s): Daniela Dorner 08/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 422 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # -
trunk/MagicSoft/Mars/datacenter/scripts/writedatasetfiles
r8193 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 33 33 # the macro checkstardone.C 34 34 # If this was successful, the status is inserted into the database using 35 # the macro setstatus.C35 # the function setstatus. 36 36 # 37 37 … … 68 68 no=`printf %08d $dataset | cut -c 0-5` 69 69 no2=`printf %08d $dataset` 70 var1=$no71 var2=$dataset72 70 datasetpathcpl=$datasetpath/$no 73 71 makedir $datasetpathcpl >> $scriptlog 2>&1 … … 75 73 makedir $writedatasetfilelogpath >> $scriptlog 2>&1 76 74 logfile=$writedatasetfilelogpath/$program-$no2.log 75 76 primvar=$dataset 77 setstatus "start" >> $scriptlog 2>&1 77 78 78 79 check1=`root -q -b $macrospath/writedatasetfile.C+\($dataset\,\""$datasetpathcpl\""\) | tee $logfile | intgrep` -
trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles
r7954 r8482 20 20 # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 32 32 # the macro writesequencefile.C 33 33 # If this was successful, the status is inserted into the database using 34 # the macro setstatus.C34 # the function setstatus. 35 35 # 36 36 … … 70 70 no=`printf %08d $sequence | cut -c 0-4` 71 71 no2=`printf %08d $sequence` 72 var1=$no73 var2=$no274 72 sequencepath=$sequpath/$no 75 73 makedir $sequencepath >> $scriptlog 2>&1 … … 80 78 81 79 echo "write sequencefile for sequence $sequence" >> $scriptlog 2>&1 80 primvar=$no2 82 81 setstatus "start" >> $scriptlog 2>&1 83 82 -
trunk/MagicSoft/Mars/datacenter/scripts/zipscript
r8331 r8482 20 20 # Author(s): Daniela Dorner 09/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 30 30 source `dirname $0`/sourcefile 31 31 printprocesslog "INFO starting $0" 32 program=zipscript 32 # to give the possibility to run several zipscripts at the same time, 33 # $1 is added 34 program=zipscript$1 33 35 34 36 set -C … … 52 54 53 55 for file in ${files[@]} 54 do 56 do 57 echo "processing file $file..." >> $scriptlog 2>&1 58 runno=`basename $file | cut -d_ -f2` 59 query="SELECT fSequenceFirst FROM RunData WHERE fRunNumber="$runno 60 echo " sending query: $query" >> $scriptlog 2>&1 61 if ! seq=`sendquery` 62 then 63 echo "querying seq for run $runno from the db did not work -> continue" >> $scriptlog 2>&1 64 printprocesslog "WARN query $seq for run $runno from the db did not work" 65 continue 66 fi 67 if [ "$seq" == "" ] 68 then 69 echo "no seq found for run $runno -> locking only run..." >> $scriptlog 2>&1 70 seq=$runno 71 fi 72 echo "locking sequence $seq..." >> $scriptlog 2>&1 73 lockfile=$lockpath/calzip$seq.txt 74 checklock continue >> $scriptlog 2>&1 75 query="UPDATE SequenceProcessStatus set fNotZipping=NULL WHERE fSequenceFirst=$seq" 76 echo " sending query: $query" >> $scriptlog 2>&1 77 if ! sendquery 78 then 79 echo "locking $seq for callisto in db did not work ..." >> $scriptlog 2>&1 80 printprocesslog "WARN locking $seq for callisto in db did not work" 81 rm -v $lockfile >> $scriptlog 2>&1 82 continue 83 fi 55 84 echo "zipping $file ..." >> $scriptlog 2>&1 56 # if ssh pegasus nice -n 19 gzip -1f $file >> $scriptlog 2>&1 57 if ssh phoenix nice -n 19 gzip -1f $file >> $scriptlog 2>&1 58 85 if ssh -x phoenix nice -n 19 gzip -1f $file >> $scriptlog 2>&1 59 86 then 60 chmod a-w $file >> $scriptlog 2>&1 87 gzfile=$file".gz" 88 chmod a-w $gzfile >> $scriptlog 2>&1 89 else 90 printprocesslog "WARN zipping $file did not work" 61 91 fi 92 echo "unlocking sequence $seq..." >> $scriptlog 2>&1 93 query="UPDATE SequenceProcessStatus set fNotZipping=Now() WHERE fSequenceFirst=$seq" 94 echo " sending query: $query" >> $scriptlog 2>&1 95 if ! sendquery 96 then 97 echo "unlocking $seq for callisto in db did not work ..." >> $scriptlog 2>&1 98 printprocesslog "ERROR unlocking $seq for callisto in db did not work" 99 rm -v $lockfile >> $scriptlog 2>&1 100 continue 101 fi 102 rm -v $lockfile >> $scriptlog 2>&1 62 103 done 63 104 105 lockfile=$lockpath/lock-$program.txt 64 106 finish >> $scriptlog 2>&1 65 107 66 67 68 # old code for running script locally69 70 #rawdatapath=$datapath/rawfiles71 ##h: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2372 #pnos=( 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 )73 #sl1=30 #sleeping time before new directory74 #sl2=60 #sleeping time before new process check75 #76 #dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort`77 ##dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort -r`78 #79 #for dir in ${dirs[@]}80 #do81 # cont=`echo $dir | cut -d/ -f7`82 # if [ "$cont" == "" ]83 # then84 # continue85 # fi86 #87 # if ! ls $dir/*.raw >/dev/null 2>&188 # then89 # echo "no unzipped rawfiles in $dir left"90 # continue91 # fi92 #93 # echo "sleeping $sl1..."94 # sleep $sl195 #96 # h=`date +%k`97 # count=`ps aux | grep gzip | grep -v grep | wc -l`98 # echo "count: $count - h: $h - pno: ${pnos[$h]}"99 # while [ "$count" -ge "${pnos[$h]}" ]100 # do101 # echo "sleeping $sl2..."102 # sleep $sl2103 # h=`date +%k`104 # count=`ps aux | grep gzip | grep -v grep | wc -l`105 # echo "count: $count - h: $h - pno: ${pnos[$h]}"106 # done107 # echo $dir108 # du -hs $dir109 # echo "gzip -1f $dir/*.raw &"110 # gzip -1f $dir/*.raw &111 #done112 #113 114 115 # old code for running script with condor116 117 #rawdatapath=$datapath/rawfiles118 ##h: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23119 #pnos=( 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 )120 #sl1=30 #sleeping time before new directory121 #sl2=60 #sleeping time before new process check122 #123 #dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort`124 ##dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort -r`125 #126 #for dir in ${dirs[@]}127 #do128 # cont=`echo $dir | cut -d/ -f7`129 # if [ "$cont" == "" ]130 # then131 # continue132 # fi133 #134 # if ! ls $dir/*.raw >/dev/null 2>&1135 # then136 # echo "no unzipped rawfiles in $dir left"137 # continue138 # fi139 #140 # echo "sleeping $sl1..."141 # sleep $sl1142 #143 # h=`date +%k`144 # count=`grep gzip .condor_run.* | wc -l`145 # echo "count: $count - h: $h - pno: ${pnos[$h]}"146 # while [ "$count" -ge "${pnos[$h]}" ]147 # do148 # echo "sleeping $sl2..."149 # sleep $sl2150 # h=`date +%k`151 # count=`grep gzip .condor_run.* | wc -l`152 # echo "count: $count - h: $h - pno: ${pnos[$h]}"153 # done154 # echo $dir155 # du -hs $dir156 # condor_run gzip -1f $dir/*.raw &157 #158 #done159 #160
Note:
See TracChangeset
for help on using the changeset viewer.