Ignore:
Timestamp:
07/23/08 17:31:23 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r8886 r9040  
    2020#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
    2121#
    22 #   Copyright: MAGIC Software Development, 2000-2007
     22#   Copyright: MAGIC Software Development, 2000-2008
    2323#
    2424#
     
    6767no=`printf %08d $sequence | cut -c 0-4`
    6868no2=`printf %08d $sequence`
     69sequfile="$sequpath/$no/sequence$no2.txt"
     70
    6971outpath="$datapath/$program/$no/$no2"
    7072makedir $outpath >> $scriptlog 2>&1
    71 sequfile="$sequpath/$no/sequence$no2.txt"
    7273
    7374# define callisto.rc files
     
    7576#callistorcmux=$setuppath/$program/callisto_mux.rc
    7677callistorcmux=$setuppath/$program/callisto_mux_new.rc
     78
    7779# find callisto.rc file
    7880if [ -e $outpath/callisto.rc ]
     
    106108# stage the needed files; to be removed as soon as the correct stub file size has been determined
    107109echo "staging files:" >> $scriptlog 2>&1
    108 day=`grep Night $sequfile | cut -c 18-27 | sed -e "s/-/\//g"`
    109 runs=`grep ^Runs $sequfile | cut -d: -f2`
    110 i=0
    111110
    112 for run in ${runs[@]}
    113 do
    114    files[i]=20*_0*${run}_[PCD]_*_E.raw.gz
    115    echo ${datapath}/rawfiles/${day}/${files[i]} >> $scriptlog 2>&1
    116    let i++
    117 done
     111echo 'root -q -b $macrospath/stage.C\("\"$sequfile\""\) | tee $scriptlog | intgrep' >> $scriptlog 2>&1
     112check0=`root -q -b $macrospath/stage.C\("\"$sequfile\""\) | tee $scriptlog | intgrep`
    118113
    119 ssh -nx phoenix "cd ${datapath}/rawfiles/${day}; /opt/SUNWsamfs/bin/stage ${files[@]}"
     114case $check0 in
     115   0)   echo " check0=$check0 -> everything ok -> files staging..." >> $scriptlog 2>&1
     116        printprocesslog "INFO staging files started for $sequence"
     117        ;;
     118   *)   echo " check0=$check0 -> an error occured..." >> $scriptlog 2>&1
     119        printprocesslog "ERROR getting sequence $sequence"
     120        check="no"
     121        ;;
     122esac
    120123
    121124
     
    131134   0)   echo " check1=$check1 -> everything ok -> doing update..." >> $scriptlog 2>&1
    132135        printprocesslog "INFO $program finished successfully for sequence $sequence"
    133         # running merpp update if calibration worked
    134         # finding files, which have to be updated
    135         echo "finding files to be updated..." >> $scriptlog 2>&1
    136         calfiles=`find $outpath -name *_Y_* `
    137         if [ "$calfiles" = "" ]
    138         then
    139            echo " no files found -> continue with next sequence" >> $scriptlog 2>&1
    140            printprocesslog "ERROR no calfiles found"
    141         fi
    142         echo " files to be updated: "$calfiles >> $scriptlog 2>&1
    143        
    144         merpplogpath=$outpath"/merpplogs"
    145         makedir $merpplogpath >> $scriptlog 2>&1
    146        
    147         printprocesslog "INFO doing merppupdate for sequence $sequence"
     136
     137        printprocesslog "INFO starting merpp/ccupdate for sequence $sequence"
     138
    148139        # updated calibrated data files with the information from the cc and caco files
    149         for calfile in ${calfiles[@]}
    150         do
    151            echo "calfile: "$calfile >> $scriptlog 2>&1
    152            # find cc and caco file
    153            # if file is missing continue with next sequence
    154            date=`date --date \`basename $calfile | cut -d_ -f1\` +%Y/%m/%d`
    155            ccpath=$subsystempath/cc/$date
    156            cacopath=$subsystempath/caco/$date
    157            runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' `
    158            ccfile=`find $ccpath -name 20[0-2][0-9][01][0-9][0-3][0-9]_*${runno}_[PDCS]_*_S.rep`
    159            source=`echo $ccfile | cut -d_ -f4`
    160            cacofile=`find /magic/subsystemdata/caco/$date -name dc_20[0-2][0-9]_[01][0-9]_[0-3][0-9]_*${runno}_${source}.txt`
    161            if [ "$ccfile" = "" ]
    162            then
    163               echo "no ccfile found for run "$runno >> $scriptlog 2>&1
    164               printprocesslog "ERROR  ccfile $ccfile not found for $calfile"
    165               com=$Fnoccfile
    166               comadd=$runno
    167               check=0
    168               break
    169            fi
    170            if [ "$cacofile" = "" ]
    171            then
    172               echo "cacofile with no $runno not found" >> $scriptlog 2>&1
    173               echo "finding cacofile..." >> $scriptlog 2>&1
    174               for (( i = 0; i <= 10; i++ ))
    175               do
    176                  newrun=`echo $runno - $i | bc`
    177                  cacofile=`find $cacopath -name *$newrun*`
    178                  if [ "$cacofile" = "" ]
    179                  then
    180                     if [ $i -eq 9 ]
    181                     then
    182                        echo "no cacofile found for runno $newrun in $cacopath" >> $scriptlog 2>&1
    183                        printprocesslog "ERROR cacofile $cacofile not found for $calfile"
    184                        com=$Fnocacofile
    185                        comadd=$runno
    186                        check=0
    187                        break 2
    188                     fi   
    189                     continue
    190                  else
    191                     echo "cacofile: "$cacofile >> $scriptlog 2>&1
    192                     break
    193                  fi
    194               done
    195            fi
    196            echo "./merpp -u --log=$merpplogpath/merppccupdate$runno.log --html=$merpplogpath/merppccupdate$runno.html --auto-time-stop --runfile=$runno $ccfile $calfile 2>> $scriptlog> /dev/null" >> $scriptlog 2>&1
    197            ./merpp -u --log=$merpplogpath/merppccupdate$runno.log --html=$merpplogpath/merppccupdate$runno.html --auto-time-stop --runfile=$runno $ccfile $calfile 2>> $scriptlog> /dev/null
    198            check2=$?
    199            case $check2 in
    200               0)   echo " check2=$check2 -> everything ok, merppccupdate worked -> continue" >> $scriptlog 2>&1
    201                    printprocesslog "INFO merppupdated $calfile sucessfully with $ccfile"
    202                    ;;
    203               *)   echo " check2=$check2 -> ERROR -> merppccupdate failed" >> $scriptlog 2>&1
    204                    printprocesslog "ERROR merppccupdate with file $ccfile failed for $calfile"
    205                    com=$Fmerppcc
    206                    comadd=$runno
    207                    check=$check2
    208                    break ;;
    209            esac
    210            echo "./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --html=$merpplogpath/merppcacoupdate$runno.html --auto-time $cacofile $calfile 2>> $scriptlog> /dev/null" >> $scriptlog 2>&1
    211            ./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --html=$merpplogpath/merppcacoupdate$runno.html --auto-time $cacofile $calfile 2>> $scriptlog> /dev/null
    212            check3=$?
    213            case $check3 in
    214               0)   echo " check3=$check3 -> everything ok, merppcacoupdate worked -> continue" >> $scriptlog 2>&1
    215                    printprocesslog "INFO merppupdated $calfile sucessfully with $cacofile"
    216                    ;;
    217               *)   echo " check3=$check3 -> ERROR -> merppcacoupdate failed" >> $scriptlog 2>&1
    218                    printprocesslog "ERROR merppcacoupdate with file $cacofile failed for $calfile"
    219                    com=$Fmerppcaco
    220                    comadd=$runno
    221                    check=$check3
    222                    break ;;
    223            esac
    224         done
    225         printprocesslog "INFO finished merppupdate successfully for sequence $sequence"
     140        echo "./merpp -v3 --log=$outpath/merpp$no2.log --html=$outpath/merpp$no2.html --auto-time-stop $sequfile $outpath 2>> $scriptlog> /dev/null" >> $scriptlog 2>&1
     141        ./merpp -v3 --log=$outpath/merpp$no2.log --html=$outpath/merpp$no2.html --auto-time-stop $sequfile $outpath 2>> $scriptlog > /dev/null
     142        check2=$?
     143
     144        case $check2 in
     145           0)   echo " check2=$check2 -> everything ok, merpp/ccupdate worked -> continue" >> $scriptlog 2>&1
     146                printprocesslog "INFO merpp/ccupdate of sequence $sequence sucessfull"
     147                ;;
     148           *)   echo " check2=$check2 -> ERROR -> merpp/ccupdate $sequence failed" >> $scriptlog 2>&1
     149                printprocesslog "ERROR merpp/ccupdate of sequence $sequence failed"
     150                com=$Fmerppcc
     151                check=$check2
     152#                comadd=$runno
     153                ;;
     154        esac
    226155        ;;
    227156   *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
Note: See TracChangeset for help on using the changeset viewer.