Ignore:
Timestamp:
05/09/07 17:05:15 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/scripts/filesondisk

    r8410 r8482  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2006
     22#   Copyright: MAGIC Software Development, 2000-2007
    2323#
    2424#
     
    3333#   this includes also the search for missing cacofiles:
    3434#   Sometimes the DAQ aborts a run and starts itself a new one. In this
    35 #   cases the camera controll doesn't start a new file, as the command to
     35#   cases the camera control doesn't start a new file, as the command to
    3636#   start a new run was not sent by the central control. So the caco
    3737#   information is stored in the previous caco file, which has a
     
    4040#   information has to be found.
    4141#   In this script the search and inserting into the database is done
    42 #   using the macros findcacofiles.C and insertcacofile.C
     42#   using the macro findcacofiles.C
    4343# - rawfiles
    4444# The update in the database is done using the macro resetallruns.C
     
    6666printprocesslog "INFO checking ccfiles"
    6767filename=$filesondisklogpath/ccfilesondisk-$datetime.txt
     68if ls $filename >/dev/null 2>&1
     69then
     70   rm -v $filename >> $scriptlog 2>&1
     71fi
    6872column=fCCFileAvail
    6973find $subsystempath/cc/ -name '*_S.rep' | cut -d_ -f2  > $filename
     
    8589
    8690
     91
    8792echo "checking disk for cacofiles..."  >> $scriptlog 2>&1
    8893printprocesslog "INFO checking cacofiles"
    8994filename=$filesondisklogpath/cacofilesondisk-$datetime.txt
     95if ls $filename >/dev/null 2>&1
     96then
     97   rm -v $filename >> $scriptlog 2>&1
     98fi
    9099column=fCaCoFileAvail
    91100find $subsystempath/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
     
    107116
    108117date=`date +%F`
    109 echo "checking missing cacofiles..." >> $scriptlog 2>&1
     118echo "finding missing cacofiles..." >> $scriptlog 2>&1
    110119printprocesslog "INFO checking missing cacofiles"
    111 check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\,"\"$filesondisklogpath\""\) | tee $filesondisklogpath/findcacofiles-$datetime.log | intgrep`
     120check1=`root -q -b $macrospath/findcacofiles.C+ | tee $filesondisklogpath/findcacofiles-$datetime.log | intgrep`
    112121
    113122case $check1 in
     
    123132esac
    124133
    125 printprocesslog "INFO finding missing cacofiles"
    126 missingcacoruns=(`cat $filesondisklogpath/findcacofiles-$date.txt`)
    127 for missingcacorun in ${missingcacoruns[@]}
    128 do
    129    runno=$missingcacorun
    130    echo "missing cacofile for run "$runno >> $scriptlog 2>&1
    131    echo "-> finding cacofile" >> $scriptlog 2>&1
    132    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/null
    133    echo " ccfile: "$ccfile  >> $scriptlog 2>&1
    134    if [ "$ccfile" = "" ]
    135    then
    136       echo " no ccfile found for run "$runno >> $scriptlog 2>&1
    137       continue
    138    fi
    139    for (( i = 0; i <= 10; i++ ))
    140    do
    141       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       then
    147          continue
    148       else
    149          printprocesslog "INFO inserting cacofile for run $missingcacorun"
    150          echo " inserting cacofile $file for run $missingcacorun..." >> $scriptlog 2>&1
    151          check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | intgrep`
    152 
    153          case $check2 in
    154             1)   echo " check2=$check2 -> everything ok -> insert is done" >> $scriptlog 2>&1
    155                  printprocesslog "INFO inserted $missingcacorun successfully"
    156                  ;;
    157             0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    158                  printprocesslog "WARN connection to DB failed"
    159                  ;;
    160             *)   echo " check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun >> $scriptlog 2>&1
    161                  printprocesslog "ERROR insertcacofile.C failed for run $missingcacorun"
    162                  ;;
    163          esac
    164          break
    165       fi
    166    done
    167    if [ "$cacofile" = "" ]
    168    then
    169       echo " no cacofile found for run "$runno >> $scriptlog 2>&1
    170       printprocesslog "WARN no cacofile found for run $runno"
    171    else
    172       echo " cacofile: "$cacofile >> $scriptlog 2>&1
    173    fi
    174 done
    175134
    176135
     
    178137printprocesslog "INFO checking rawfiles"
    179138filename=$filesondisklogpath/rawfilesondisk-$datetime.txt
     139if ls $filename >/dev/null 2>&1
     140then
     141   rm -v $filename >> $scriptlog 2>&1
     142fi
    180143column=fRawFileAvail
    181144find $datapath/rawfiles -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename
Note: See TracChangeset for help on using the changeset viewer.