Changeset 12623 for trunk/DataCheck


Ignore:
Timestamp:
11/23/11 05:42:34 (13 years ago)
Author:
Daniela Dorner
Message:
added new version of start and stop time
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/CheckRawData.sh

    r12609 r12623  
    3030# get last 3 nights
    3131dates=( `date +%Y/%m/%d` `date +%Y/%m/%d --date="-1day"` `date +%Y/%m/%d --date="-2day"` `date +%Y/%m/%d --date="-3day"` )
    32 dates=( `date +%Y/%m/%d --date="-2day"` )
     32dates=( `date +%Y/%m/%d --date="-3day"` )
    3333
    3434# do rsync for rawfiles of these dates
     
    129129      query5="SELECT fRunNumber FROM RunInfo WHERE fRunNumber="$runnumber" AND fFileNumber="$filenumberfromfileorig
    130130      query5=$query5" AND NOT ISNULL(fMd5sumRaw) AND NOT ISNULL(fMd5sumRawZip)"
    131       echo "Q5:"$query5 >> $logfile 2>&1 2>&1
     131      echo "Q5:"$query5 >> $logfile 2>&1
    132132      result5=`/usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query5"`
    133133
     
    143143         if [ "$skipmd5sum" == "no" ] || [ "$result5" == "" ]
    144144         then
    145             echo "calculation md5sum for raw..." >> $logfile 2>&1
    146             md5sum=`md5sum $file | cut -d' ' -f1`
    147145            zipfile=`echo $file | sed -e 's/raw/zipraw/' -e 's/fits/fits.gz/'`
    148             echo "calculation md5sum for zipraw..." >> $logfile 2>&1
    149             md5sumzip=`md5sum $zipfile | cut -d' ' -f1`
     146            # only do the md5sum if the zipfile is already available
     147            if ls $zipfile >/dev/null >> $logfile 2>&1
     148            then
     149               echo "calculation md5sum for raw..." >> $logfile 2>&1
     150               md5sum=`md5sum $file | cut -d' ' -f1`
     151               echo "calculation md5sum for zipraw..." >> $logfile 2>&1
     152               md5sumzip=`md5sum $zipfile | cut -d' ' -f1`
     153            fi
    150154         fi
    151155      fi
     
    159163      roi=`/home/fact/FACT++/fitsdump -h -t Events $file  2>/dev/null | grep NROI | grep -v NROITM | grep -E -o '[0-9]{1,4}'`
    160164      numevents=`/home/fact/FACT++/fitsdump -h -t Events $file  2>/dev/null | grep Events | grep -E -o '[0-9]+'`
    161       runstart=`/home/fact/FACT++/fitsdump -h -t Events $file  2>/dev/null | grep TSTART | grep -E -o '20[1-9][0-9][\-][01][0-9][\-][0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9][.][0-9]{6}'`
    162       runstop=`/home/fact/FACT++/fitsdump -h -t Events $file  2>/dev/null | grep TSTOP | grep -E -o '20[1-9][0-9][\-][01][0-9][\-][0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9][.][0-9]{6}'`
     165      # in newest data start time is in DATE-OBS
     166      # in older data start time is in TSTART
     167      # in the beginning TSTART was empty
     168      runstart=`/home/fact/FACT++/fitsdump -h -t Events $file  2>/dev/null | grep DATE-OBS | grep -E -o '20[1-9][0-9][\-][01][0-9][\-][0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9][.][0-9]{6}'`
     169      runstart2=`/home/fact/FACT++/fitsdump -h -t Events $file  2>/dev/null | grep TSTART | grep -E -o '20[1-9][0-9][\-][01][0-9][\-][0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9][.][0-9]{6}'`
    163170      if [ "$runstart" == ""  ]
    164171      then
    165          runstart=`/home/fact/FACT++/fitsdump -h -t Events $file  2>/dev/null | grep DATE | grep -E -o '20[1-9][0-9][\-][01][0-9][\-][0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9][.][0-9]{6}'`
    166       fi
     172         if [ "$runstart2" == ""  ]
     173         then
     174            runstart=`/home/fact/FACT++/fitsdump -h -t Events $file  2>/dev/null | grep DATE | grep -v 'DATE-' | grep -E -o '20[1-9][0-9][\-][01][0-9][\-][0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9][.][0-9]{6}'`
     175         else
     176            runstart=$runstart2
     177         fi
     178      fi
     179      # in newest data start time is in DATE-END
     180      # in older data start time is in TSTOP
     181      # in the beginning TSTOP was empty
     182      runstop=`/home/fact/FACT++/fitsdump -h -t Events $file  2>/dev/null | grep DATE-END | grep -E -o '20[1-9][0-9][\-][01][0-9][\-][0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9][.][0-9]{6}'`
     183      runstop2=`/home/fact/FACT++/fitsdump -h -t Events $file  2>/dev/null | grep TSTOP | grep -E -o '20[1-9][0-9][\-][01][0-9][\-][0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9][.][0-9]{6}'`
    167184      if [ "$runstop" == ""  ]
    168185      then
    169          runstop=`stat $file  2>/dev/null | grep Modify | grep -E -o '20[1-9][0-9][\-][01][0-9][\-][0-3][0-9][ ][0-2][0-9]:[0-6][0-9]:[0-6][0-9][.][0-9]{9}'`
     186         if [ "$runstop2" == ""  ]
     187         then
     188            runstop=`stat $file  2>/dev/null | grep Modify | grep -E -o '20[1-9][0-9][\-][01][0-9][\-][0-3][0-9][ ][0-2][0-9]:[0-6][0-9]:[0-6][0-9][.][0-9]{9}'`
     189         else
     190            runstop=$runstop2
     191         fi
    170192      fi
    171193
     
    207229      query4=$query4" "$querystop
    208230      echo "Q4:"$query4 >> $logfile 2>&1
    209       if ! /usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query4"
     231      if ! /usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query4" >> $logfile 2>&1
    210232      then
    211233         echo "insert/update of "$numfromfile" to mysql" >> $logfile 2>&1
Note: See TracChangeset for help on using the changeset viewer.