| [535] | 1 | #!/bin/sh -xvf
 | 
|---|
 | 2 | #Perform the ON-OFF analysis
 | 
|---|
 | 3 | DATE=/bin/date
 | 
|---|
 | 4 | GREP=/bin/grep
 | 
|---|
 | 5 | AWK=/bin/awk
 | 
|---|
 | 6 | ECHO=/bin/echo
 | 
|---|
 | 7 | WC=/usr/bin/wc
 | 
|---|
 | 8 | CAT=/bin/cat
 | 
|---|
 | 9 | PRINTF=/usr/bin/printf
 | 
|---|
 | 10 | FIND=/usr/bin/find
 | 
|---|
 | 11 | MKDIR=/bin/mkdir
 | 
|---|
 | 12 | XARGS=/usr/bin/xargs
 | 
|---|
 | 13 | SORT=/bin/sort
 | 
|---|
 | 14 | RM=/bin/rm
 | 
|---|
 | 15 | TR=/usr/bin/tr
 | 
|---|
 | 16 | CP=/bin/cp
 | 
|---|
 | 17 | LS=/bin/ls
 | 
|---|
 | 18 | CHMOD=/bin/chmod
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 | DefaultIFS=$' \t\n'
 | 
|---|
 | 21 | IFS=$DefaultIFS
 | 
|---|
 | 22 | 
 | 
|---|
 | 23 | #set Irods environment    
 | 
|---|
 | 24 | . /usr/local/shared/bin/irods_env.sh -noverbose
 | 
|---|
 | 25 | 
 | 
|---|
 | 26 | scriptName="`basename $0`"
 | 
|---|
 | 27 | $ECHO "Processing script ${scriptName} at `date`"
 | 
|---|
 | 28 | #which source to analyse
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | #Process cmd line args: the -src option is mandatory (source name as Abell85)
 | 
|---|
 | 31 | sourceRadio=
 | 
|---|
 | 32 | dateSelected=
 | 
|---|
 | 33 | #use -sim option to simulate processing (debug the script as if...)
 | 
|---|
 | 34 | simulationMode=Off
 | 
|---|
 | 35 | while [ $# -gt 0 ]
 | 
|---|
 | 36 |   do
 | 
|---|
 | 37 |   case "$1" in
 | 
|---|
 | 38 |       -src)  sourceRadio=$2;    shift;;
 | 
|---|
 | 39 | -date) dateSelected=$2;     shift;;
 | 
|---|
 | 40 | -sim)  simulationMode=On;;
 | 
|---|
 | 41 | -h)
 | 
|---|
 | 42 | echo >&2 \
 | 
|---|
 | 43 |     "usage: $0 -src souce -date YYYYMMDD [-freq freq in MHz (default ${freqBAOCalib})] [-sim to trig simulation mode]"
 | 
|---|
 | 44 | exit 1;;
 | 
|---|
 | 45 | *)  break;;     # terminate while loop
 | 
|---|
 | 46 | esac
 | 
|---|
 | 47 | shift
 | 
|---|
 | 48 | done
 | 
|---|
 | 49 | 
 | 
|---|
 | 50 | if [ ${simulationMode} = "On" ]; then
 | 
|---|
 | 51 |     $ECHO "INFO ${scriptName} running in SIMUL mode"
 | 
|---|
 | 52 | fi
 | 
|---|
 | 53 | 
 | 
|---|
 | 54 | if [ "<${sourceRadio}>" = "<>" ]; then
 | 
|---|
 | 55 |     $ECHO "FATAL: You have forgotten to select the source option (-src)"
 | 
|---|
 | 56 |     exit 1
 | 
|---|
 | 57 | fi
 | 
|---|
 | 58 | 
 | 
|---|
 | 59 | case ${sourceRadio} in
 | 
|---|
 | 60 |     Abell85) $ECHO "INFO (${scriptName}): process ${sourceRadio}";;
 | 
|---|
 | 61 |     Abell2440) $ECHO "INFO (${scriptName}): process ${sourceRadio}";;
 | 
|---|
 | 62 |     Abell1205) $ECHO "INFO (${scriptName}): process ${sourceRadio}";;
 | 
|---|
 | 63 |     *) ECHO "FATAL (${scriptName}): process ${sourceRadio} not yet foreseen"
 | 
|---|
 | 64 |     exit 1;;
 | 
|---|
 | 65 | esac
 | 
|---|
 | 66 | 
 | 
|---|
 | 67 | srclower=`${ECHO} ${sourceRadio} | ${TR} "[:upper:]" "[:lower:]" `
 | 
|---|
 | 68 | 
 | 
|---|
 | 69 | #Path to public backupable path
 | 
|---|
 | 70 | publicpath="/afs/in2p3.fr/home/c/campagne/public"
 | 
|---|
 | 71 | 
 | 
|---|
 | 72 | 
 | 
|---|
 | 73 | #temporary files to synchronize scripts
 | 
|---|
 | 74 | tmppublicpath=${TMPPUBLICPATH}
 | 
|---|
 | 75 | #wakeup the NFS disk
 | 
|---|
 | 76 | $LS -l ${tmppublicpath} > /dev/null
 | 
|---|
 | 77 | #clean previous spurious files
 | 
|---|
 | 78 | $RM -f ${tmppublicpath}/*.finished
 | 
|---|
 | 79 | 
 | 
|---|
 | 80 | #Path where the job will do temporary IO
 | 
|---|
 | 81 | if [ ${ENVIRONMENT} = "INTERACTIVE" ]; then
 | 
|---|
 | 82 |     iojobpath="/sps/baoradio/AmasNancay/JEC"
 | 
|---|
 | 83 |     $MKDIR -p $iojobpath
 | 
|---|
 | 84 | elif [ ${ENVIRONMENT} = "BATCH" ] ; then
 | 
|---|
 | 85 |     iojobpath=${TMPBATCH}
 | 
|---|
 | 86 | else
 | 
|---|
 | 87 |     $ECHO "FATAL (${scriptName}): environment is ${ENVIRONMENT} not allowed"
 | 
|---|
 | 88 |     exit 1
 | 
|---|
 | 89 | fi
 | 
|---|
 | 90 | cd ${iojobpath}
 | 
|---|
 | 91 | 
 | 
|---|
 | 92 | localpath="${sourceRadio}"
 | 
|---|
 | 93 | $MKDIR -p ./${localpath}
 | 
|---|
 | 94 | cd ./${localpath}
 | 
|---|
 | 95 | 
 | 
|---|
 | 96 | #save the top directory
 | 
|---|
 | 97 | topDir=`pwd`
 | 
|---|
 | 98 | 
 | 
|---|
 | 99 | #Path of the utility scripts
 | 
|---|
 | 100 | scriptpath="/afs/in2p3.fr/home/c/campagne/private/work/AmasNancay"
 | 
|---|
 | 101 | 
 | 
|---|
 | 102 | #get the daq current irod status
 | 
|---|
 | 103 | tag=`${DATE} +%F`
 | 
|---|
 | 104 | OUT1=${publicpath}/baodaqstatus-${tag}.txt
 | 
|---|
 | 105 | 
 | 
|---|
 | 106 | if [ ! -e ${OUT1}  -o ! -r ${OUT1} ]; then
 | 
|---|
 | 107 |     $ECHO "We should bring the DAQ status more up to date, this take 1 or 2sec..."
 | 
|---|
 | 108 |     $RM -f ${tmppublicpath}/statusdaq.finished
 | 
|---|
 | 109 |     ${scriptpath}/statusdaq.sh > ${OUT1}
 | 
|---|
 | 110 |     while [ ! -f "${tmppublicpath}/statusdaq.finished" ]; do
 | 
|---|
 | 111 |         sleep 30
 | 
|---|
 | 112 |     done
 | 
|---|
 | 113 |     $RM ${tmppublicpath}/statusdaq.finished
 | 
|---|
 | 114 | #protect against remove/rewriting    
 | 
|---|
 | 115 |     $CHMOD -v 444 ${OUT1} 
 | 
|---|
 | 116 | fi
 | 
|---|
 | 117 | 
 | 
|---|
 | 118 | 
 | 
|---|
 | 119 | 
 | 
|---|
 | 120 | $ECHO "You have selected sourceRadio = ${sourceRadio} [date = ${dateSelected}]"
 | 
|---|
 | 121 | tableau=( `$GREP -i "${dateSelected}${srclower}" ${OUT1} | $AWK '( NF==4 ) { print $2 }' ` )
 | 
|---|
 | 122 | IFS='
 | 
|---|
 | 123 | ' 
 | 
|---|
 | 124 | tableau=( $( $PRINTF "%s\n" "${tableau[@]}" | $AWK 'x[$0]++ == 0' ) )
 | 
|---|
 | 125 | IFS=$DefaultIFS
 | 
|---|
 | 126 | 
 | 
|---|
 | 127 | 
 | 
|---|
 | 128 | for i in ${tableau[@]}
 | 
|---|
 | 129 |   do
 | 
|---|
 | 130 | #
 | 
|---|
 | 131 | # start a "fresh" session  
 | 
|---|
 | 132 |   cd ${topDir}
 | 
|---|
 | 133 |   $LS | $XARGS -i $RM -rf {}
 | 
|---|
 | 134 |   
 | 
|---|
 | 135 |   $ECHO "DEBUG: (${scriptName}) irods root dir $i"
 | 
|---|
 | 136 |   dateDAQ=`$ECHO ${i} | $AWK '{split($0,a,"/"); print a[6];}' | $AWK "{sub(/${srclower}/,\"\"); print}"`
 | 
|---|
 | 137 | 
 | 
|---|
 | 138 |   $ECHO "DEBUG: (${scriptName}): we are in directory `pwd` the topDir=${topDir}"
 | 
|---|
 | 139 |   $LS -lrt
 | 
|---|
 | 140 | 
 | 
|---|
 | 141 | 
 | 
|---|
 | 142 | #Look if the date has changed since beginning of the job!
 | 
|---|
 | 143 |   curtag=`${DATE} +%F`
 | 
|---|
 | 144 |   if [ "<${curtag}>" != "<${tag}>" ]; then
 | 
|---|
 | 145 |       tag=${curtag}
 | 
|---|
 | 146 | #it is necessary to update the daq status as the day has changed during the processing... (batch can take a long time...)
 | 
|---|
 | 147 |       OUT1=${publicpath}/baodaqstatus-${curtag}.txt
 | 
|---|
 | 148 |       $ECHO "We should bring the DAQ status more up to date, this take 1 or 2sec..."
 | 
|---|
 | 149 |       $RM -f ${tmppublicpath}/statusdaq.finished
 | 
|---|
 | 150 |       ${scriptpath}/statusdaq.sh > ${OUT1}
 | 
|---|
 | 151 |       while [ ! -f "${tmppublicpath}/statusdaq.finished" ]; do
 | 
|---|
 | 152 |           sleep 30
 | 
|---|
 | 153 |       done
 | 
|---|
 | 154 |       $RM ${tmppublicpath}/statusdaq.finished
 | 
|---|
 | 155 | #protect against remove/rewriting    
 | 
|---|
 | 156 |       $CHMOD -v 444 ${OUT1} 
 | 
|---|
 | 157 |   fi
 | 
|---|
 | 158 | #
 | 
|---|
 | 159 | # look if the gain & calibration files exist
 | 
|---|
 | 160 | #
 | 
|---|
 | 161 |   gainDone=`ils ${i} 2>&1 | $GREP -i "gain_.*\.fits" | $WC -l`
 | 
|---|
 | 162 |   if [ ! ${gainDone} -gt 0 ]; then
 | 
|---|
 | 163 |       $ECHO "FATAL (${scriptName}): gain file DOES NOT exist skip `basename $i` "
 | 
|---|
 | 164 |       continue
 | 
|---|
 | 165 |   fi
 | 
|---|
 | 166 | 
 | 
|---|
 | 167 | ######
 | 
|---|
 | 168 |   $ECHO ">>>>>>>>>>>>> ANALYSIS Part of ${sourceRadio} ${dateDAQ}"
 | 
|---|
 | 169 | #go to the .../source/date-sourcelowercase directory
 | 
|---|
 | 170 | #download Off/datacycle<> and On/datacycle<> directories
 | 
|---|
 | 171 |   $MKDIR -p ${topDir}/${dateDAQ}${srclower}
 | 
|---|
 | 172 |   cd ${topDir}/${dateDAQ}${srclower}
 | 
|---|
 | 173 |   aboveOnOffDir=`pwd`
 | 
|---|
 | 174 |   $ECHO "DEBUG (${scriptName}): we are in directory: <`pwd`>"
 | 
|---|
 | 175 | #
 | 
|---|
 | 176 |   mode="Off"
 | 
|---|
 | 177 |   $ECHO "DEBUG (${scriptName}): START download the ${mode} data fits files"
 | 
|---|
 | 178 |   inFileDirectory="./${mode}"
 | 
|---|
 | 179 |   $MKDIR -p ${inFileDirectory}
 | 
|---|
 | 180 |   listOfDataCycle=( `ils ${i}/${mode} 2>&1 | $GREP -i "datacycle"|$AWK 'BEGIN{FS="C- "}{print $2}' | $XARGS -i basename {} | $SORT -k1.10n` )
 | 
|---|
 | 181 |   IFS='
 | 
|---|
 | 182 | '
 | 
|---|
 | 183 |   listOfDataCycle=( $( $PRINTF "%s\n" "${listOfDataCycle[@]}" | $AWK 'x[$0]++ == 0' ) )
 | 
|---|
 | 184 |   IFS=$DefaultIFS
 | 
|---|
 | 185 | 
 | 
|---|
 | 186 |   firstCycleOff=`$ECHO ${listOfDataCycle[0]} | $AWK '{match($0,"[0-9]+",arr); print arr[0]}'`
 | 
|---|
 | 187 |   nCyclesOff=`expr ${#listOfDataCycle[*]} - 1`
 | 
|---|
 | 188 | 
 | 
|---|
 | 189 |   if [ ${nCyclesOff} -eq -1 ]; then
 | 
|---|
 | 190 |       continue
 | 
|---|
 | 191 |   fi
 | 
|---|
 | 192 | 
 | 
|---|
 | 193 |   lastCycleOff=`$ECHO ${listOfDataCycle[${nCyclesOff}]} | $AWK '{match($0,"[0-9]+",arr); print arr[0]}'`
 | 
|---|
 | 194 | 
 | 
|---|
 | 195 |   listOfDataCycle=( "${listOfDataCycle[@]/#/${i}/${mode}/}" )
 | 
|---|
 | 196 | 
 | 
|---|
 | 197 |   
 | 
|---|
 | 198 |   for j in ${listOfDataCycle[@]}
 | 
|---|
 | 199 |     do
 | 
|---|
 | 200 |     irodsDownDir="${j}"
 | 
|---|
 | 201 |     OUT=./getInFits.$$
 | 
|---|
 | 202 |     iget -r -f -K ${irodsDownDir} ${inFileDirectory} > ${OUT} 2>&1
 | 
|---|
 | 203 |     igetStatus=`$GREP "^ERROR" ${OUT}`
 | 
|---|
 | 204 |     if [ "<$igetStatus>" != "<>" ]; then
 | 
|---|
 | 205 |         $ECHO "FATAL (${scriptName}): error while iget fits files:"
 | 
|---|
 | 206 |         $ECHO $igetStatus
 | 
|---|
 | 207 |         $ECHO " ==> skip this run $sourceRadio $dateDAQ"
 | 
|---|
 | 208 |         continue
 | 
|---|
 | 209 |     fi
 | 
|---|
 | 210 |     $RM -f ${OUT}
 | 
|---|
 | 211 |   done
 | 
|---|
 | 212 |   $ECHO "DEBUG (${scriptName}): END download the ${mode} data fits files"
 | 
|---|
 | 213 | #
 | 
|---|
 | 214 |   mode="On"
 | 
|---|
 | 215 |   $ECHO "DEBUG (${scriptName}): START download the ${mode} data fits files"
 | 
|---|
 | 216 |   inFileDirectory="./${mode}"
 | 
|---|
 | 217 |   $MKDIR -p ${inFileDirectory}
 | 
|---|
 | 218 | 
 | 
|---|
 | 219 |   listOfDataCycle=( `ils ${i}/${mode} 2>&1 | $GREP -i "datacycle" |$AWK 'BEGIN{FS="C- "}{print $2}' | $XARGS -i basename {} | $SORT -k1.10n` )
 | 
|---|
 | 220 |   IFS='
 | 
|---|
 | 221 | '
 | 
|---|
 | 222 |   listOfDataCycle=( $( $PRINTF "%s\n" "${listOfDataCycle[@]}" | $AWK 'x[$0]++ == 0' ) )
 | 
|---|
 | 223 |   IFS=$DefaultIFS
 | 
|---|
 | 224 | 
 | 
|---|
 | 225 |   firstCycleOn=`$ECHO ${listOfDataCycle[0]} | $AWK '{match($0,"[0-9]+",arr); print arr[0]}'`
 | 
|---|
 | 226 |   nCyclesOn=`expr ${#listOfDataCycle[*]} - 1`
 | 
|---|
 | 227 | 
 | 
|---|
 | 228 |   if [ ${nCyclesOn} -eq -1 ]; then
 | 
|---|
 | 229 |       continue
 | 
|---|
 | 230 |   fi
 | 
|---|
 | 231 | 
 | 
|---|
 | 232 |   lastCycleOn=`$ECHO ${listOfDataCycle[${nCyclesOn}]} | $AWK '{match($0,"[0-9]+",arr); print arr[0]}'`
 | 
|---|
 | 233 | 
 | 
|---|
 | 234 |   listOfDataCycle=( "${listOfDataCycle[@]/#/${i}/${mode}/}" )
 | 
|---|
 | 235 | 
 | 
|---|
 | 236 | #
 | 
|---|
 | 237 | #Check if there is the same number of cycles in Off and On mode
 | 
|---|
 | 238 | #      
 | 
|---|
 | 239 | #first cycle = max(firstCycleOn, firstCycleOff)
 | 
|---|
 | 240 | #last  cycle = min(lastCycleOn,lastCycleOff)
 | 
|---|
 | 241 | 
 | 
|---|
 | 242 |   if [ ${firstCycleOn} -eq ${firstCycleOff} -a ${lastCycleOn} -eq ${lastCycleOff} ]; then
 | 
|---|
 | 243 |       firstCycle=${firstCycleOff}
 | 
|---|
 | 244 |       lastCycle=${lastCycleOff}
 | 
|---|
 | 245 |   else
 | 
|---|
 | 246 |       $ECHO "INFO (${scriptName}): missmatch between Off and On mode"
 | 
|---|
 | 247 |       $ECHO "${firstCycleOn} != ${firstCycleOff} OR ${lastCycleOn} != ${lastCycleOff}"
 | 
|---|
 | 248 |       firstCycle=${firstCycleOff}
 | 
|---|
 | 249 |       if [ ${firstCycleOn} -gt ${firstCycle} ]; then
 | 
|---|
 | 250 |           firstCycle=${firstCycleOn}
 | 
|---|
 | 251 |       fi
 | 
|---|
 | 252 |       lastCycle=${lastCycleOff}
 | 
|---|
 | 253 |       if [ ${lastCycleOn} -lt ${lastCycle} ]; then
 | 
|---|
 | 254 |           lastCycle=${lastCycleOn}
 | 
|---|
 | 255 |       fi
 | 
|---|
 | 256 |   fi
 | 
|---|
 | 257 |   $ECHO "INFO (${scriptName}): use cycles [${firstCycle}, ${lastCycle}]"
 | 
|---|
 | 258 |   
 | 
|---|
 | 259 | 
 | 
|---|
 | 260 |   for j in ${listOfDataCycle[@]}
 | 
|---|
 | 261 |     do
 | 
|---|
 | 262 |     irodsDownDir="${j}"
 | 
|---|
 | 263 |     OUT=./getInFits.$$
 | 
|---|
 | 264 |     iget -r -f -K ${irodsDownDir} ${inFileDirectory} > ${OUT} 2>&1
 | 
|---|
 | 265 |     igetStatus=`$GREP "^ERROR" ${OUT}`
 | 
|---|
 | 266 |     if [ "<$igetStatus>" != "<>" ]; then
 | 
|---|
 | 267 |         $ECHO "FATAL (${scriptName}): error while iget fits files:"
 | 
|---|
 | 268 |         $ECHO $igetStatus
 | 
|---|
 | 269 |         $ECHO " ==> skip this run $sourceRadio $dateDAQ"
 | 
|---|
 | 270 |         continue
 | 
|---|
 | 271 |     fi
 | 
|---|
 | 272 |     $RM -f ${OUT}
 | 
|---|
 | 273 |   done
 | 
|---|
 | 274 |   $ECHO "DEBUG (${scriptName}): END download the ${mode} data fits files"
 | 
|---|
 | 275 | #Get sca file
 | 
|---|
 | 276 |   $ECHO "DEBUG (${scriptName}): START call getscafiles.sh ${sourceRadio} ${dateDAQ}"
 | 
|---|
 | 277 |   OUT1=./getScaStatus.$$
 | 
|---|
 | 278 |   $RM -f ${tmppublicpath}/getscafiles.finished
 | 
|---|
 | 279 |   ${scriptpath}/getscafiles.sh ${sourceRadio} ${dateDAQ} > ${OUT1} 2>&1
 | 
|---|
 | 280 |   while [ ! -f "${tmppublicpath}/getscafiles.finished" ]; do
 | 
|---|
 | 281 |       $ECHO "INFO (${scriptName}): waiting for ${tmppublicpath}/getscafiles.finished"
 | 
|---|
 | 282 |       date +%T
 | 
|---|
 | 283 |       sleep 30
 | 
|---|
 | 284 |   done
 | 
|---|
 | 285 |   $RM ${tmppublicpath}/getscafiles.finished
 | 
|---|
 | 286 |   $ECHO "DEBUG (${scriptName}): END"
 | 
|---|
 | 287 | #
 | 
|---|
 | 288 |   getScaStatus=`$GREP "^\(FATAL\|ERROR\)" ${OUT1}`
 | 
|---|
 | 289 | #       
 | 
|---|
 | 290 |   if [ "<${getScaStatus}>" != "<>" ]; then
 | 
|---|
 | 291 |       $ECHO "FATAL (${scriptName}): error to get sca file for $sourceRadio $dateDAQ"
 | 
|---|
 | 292 |       $ECHO "DEBUG (${scriptName}): START with cat ${OUT1}"
 | 
|---|
 | 293 |       $CAT ${OUT1}
 | 
|---|
 | 294 |       $ECHO "DEBUG (${scriptName}): END"
 | 
|---|
 | 295 |       continue
 | 
|---|
 | 296 |   fi
 | 
|---|
 | 297 |   $RM -f ${OUT1}
 | 
|---|
 | 298 | 
 | 
|---|
 | 299 |   scaFile=`$FIND . -name "sca*.sum.trans" | $XARGS -i basename {}`
 | 
|---|
 | 300 | 
 | 
|---|
 | 301 |   
 | 
|---|
 | 302 | #prepare job submission
 | 
|---|
 | 303 |   cd ${aboveOnOffDir}
 | 
|---|
 | 304 | #the default spectra name is medfiltmtx, otherwise use -specname <a_string>
 | 
|---|
 | 305 | 
 | 
|---|
 | 306 |   logFile="analyse_RAWDATA_${sourceRadio}_${dateDAQ}.log"
 | 
|---|
 | 307 |   $ECHO "DEBUG (${scriptName}): execute the analysis... should not take long. `date`"
 | 
|---|
 | 308 |   if [ ${simulationMode} = "On" ]; then
 | 
|---|
 | 309 |       $ECHO "SIMUL: ${scriptpath}/Objs/analyse -act rawOnOff -inPath ${iojobpath}  -source  ${sourceRadio} -date ${dateDAQ} -sca ${scaFile} -specdir datacycle -numcycle ${firstCycle},${lastCycle} -debug 1 >& ${logFile}"
 | 
|---|
 | 310 |       cat > ${logFile} <<EOF
 | 
|---|
 | 311 |       Ok rawOnOff finished
 | 
|---|
 | 312 | EOF
 | 
|---|
 | 313 |   else
 | 
|---|
 | 314 |       ${scriptpath}/Objs/analyse -act rawOnOff -inPath ${iojobpath}  -source  ${sourceRadio} -date ${dateDAQ} -sca ${scaFile} -specdir datacycle -numcycle ${firstCycle},${lastCycle} -debug 1 >& ${logFile}
 | 
|---|
 | 315 |   fi
 | 
|---|
 | 316 |   $ECHO "DEBUG (${scriptName}): analysis finished `date`. Look for errors before saving to Irods"
 | 
|---|
 | 317 |   rcstatus=`$GREP -i "Ok rawOnOff finished" ${logFile} | $WC -l`
 | 
|---|
 | 318 |   if [ ${rcstatus} -eq 0 ]; then
 | 
|---|
 | 319 |       $ECHO "INFO (${scriptName}): analysis problem for ${sourceRadio} ${dateDAQ}"
 | 
|---|
 | 320 |       $ECHO "                      START logfile"
 | 
|---|
 | 321 |       $CAT ${logFile}
 | 
|---|
 | 322 |       $ECHO "                      END   logFile"
 | 
|---|
 | 323 | #clean and leave
 | 
|---|
 | 324 |       cd ${aboveOnOffDir}
 | 
|---|
 | 325 |       $LS | $XARGS -i $RM -rf {}
 | 
|---|
 | 326 |       continue
 | 
|---|
 | 327 |   fi
 | 
|---|
 | 328 | #Save into Irods
 | 
|---|
 | 329 |   $ECHO "DEBUG (${scriptName}): START save output files"
 | 
|---|
 | 330 |   $LS ${aboveOnOffDir}
 | 
|---|
 | 331 | #use -f option for iput ONLY to force override
 | 
|---|
 | 332 |   if [ ${simulationMode} = "On" ]; then
 | 
|---|
 | 333 |       $ECHO "SIMUL: here we look for output files and put them in Irods"
 | 
|---|
 | 334 |   else
 | 
|---|
 | 335 |       $LS -lrth
 | 
|---|
 | 336 |       $FIND . -name "dataRaw_*"      -print | $XARGS -i  iput -f -v -K {} ${i}
 | 
|---|
 | 337 |       $FIND . -name "diffOnOffRaw_*" -print | $XARGS -i  iput -f -v -K {} ${i}
 | 
|---|
 | 338 |   fi
 | 
|---|
 | 339 | #save analysis logfile
 | 
|---|
 | 340 |   $LS -l ${tmppublicpath} > /dev/null
 | 
|---|
 | 341 |   $CP ${logFile} ${tmppublicpath}
 | 
|---|
 | 342 |   $ECHO "DEBUG (${scriptName}): END save output files"
 | 
|---|
 | 343 | #clean up to avoid scratch SIZE EXCEED LIMIT
 | 
|---|
 | 344 |   cd ${aboveOnOffDir}
 | 
|---|
 | 345 |   $LS | $XARGS -i $RM -rf {}
 | 
|---|
 | 346 | 
 | 
|---|
 | 347 | done
 | 
|---|
 | 348 | 
 | 
|---|
 | 349 | exit 0
 | 
|---|