Ignore:
Timestamp:
02/19/09 21:22:19 (16 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r9217 r9355  
    1 #!/bin/sh
     1        #!/bin/sh
    22#
    33# ========================================================================
     
    3535set -C
    3636
    37 scriptlog=$runlogpath/$program-$datetime.log
    38 date >> $scriptlog 2>&1
    39 
    4037# check if script is already running
    4138lockfile=$lockpath/lock-$program.txt
    42 checklock  >> $scriptlog 2>&1
     39checklock
    4340
    4441getdbsetup
     
    4845#workaround
    4946cameradirs=`find /magic/montecarlo/camera -maxdepth 4 -mindepth 2 -type d ! -name Gamma ! -name Muon ! -name Proton ! -name Spot_?.?`
    50 echo "camera dirs: "${cameradirs[@]}  >> $scriptlog 2>&1
    51 echo "" >> $scriptlog 2>&1
     47printprocesslog "INFO camera dirs: "${cameradirs[@]}
    5248
    5349cd $mars
     
    6662   fi
    6763   epo=`echo $cameradir | cut -d/ -f5` #epoch
    68    echo "dir: "$cameradir >> $scriptlog 2>&1
     64   printprocesslog "INFO dir: "$cameradir
    6965   fillcamerapath=$logpath/$program
    70    makedir $fillcamerapath >> $scriptlog 2>&1
     66   makedir $fillcamerapath
    7167   fillcameralog=$fillcamerapath/$program-$epo-$par-$spot-$cam.log
    7268   
     
    7470#   check0=`root -q -b $macrospath/fillcamera.C+\("\"$cameradir\""\,kTRUE\) | tee $fillcameralog | intgrep`
    7571   case $check0 in
    76       1)   echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1
    77            printprocesslog "INFO fillcamera run successfully for dir $cameradir"
     72      1)   printprocesslog "INFO fillcamera run successfully for dir $cameradir (check0=$check0)"
    7873           ;;
    79       0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    80            printprocesslog "WARN connection to DB failed"
     74      0)   printprocesslog "WARN connection to DB failed (check0=$check0)"
    8175           check="no"
    8276           ;;
    83       *)   echo "check0=$check0 -> ERROR " >> $scriptlog 2>&1
    84            printprocesslog "ERROR $program.C failed for dir $cameradir"
     77      *)   printprocesslog "ERROR $program.C failed for dir $cameradir (check0=$check0)"
    8578           ;;
    8679   esac
    8780   
    8881   printprocesslog "INFO linking cal and ped files"
    89    echo "linking cal and ped files" >> $scriptlog 2>&1
    9082   
    9183   if [ $cam = "Cal_and_Ped" ];
    9284   then
    93       echo "Cal_and_Ped folder, no cal and ped files will be linked" >> $scriptlog 2>&1
     85      printprocesslog "INFO Cal_and_Ped folder, no cal and ped files will be linked"
    9486   else
    9587
     
    9991      calfile=`find $mccampath/$epo/Cal_and_Ped -name *_C_*.root`
    10092   
    101       echo "calfile for epoch $epo : " $calfile >> $scriptlog 2>&1
    102       echo "pedfile for epoch $epo : " $pedfile >> $scriptlog 2>&1
     93      printprocesslog "INFO calfile for epoch $epo : " $calfile
     94      printprocesslog "INFO pedfile for epoch $epo : " $pedfile
    10395   
    10496      #check number of files
     
    10799      if [ "$numfiles" != "2" ]
    108100      then
    109         echo "too many or too less files in the directory $epo/Cal_and_Ped -> exit" >> $scriptlog 2>&1
    110         rm -v $lockfile >> $scriptlog 2>&1
    111         exit
    112         printprocesslog "ERROR too many ped and cal files found in $epo/Cal_and_Ped"
    113         finish >> $scriptlog 2>&1
     101        printprocesslog "ERROR too many or too less ped and cal files found in $epo/Cal_and_Ped"
     102        finish
    114103      fi
    115104     
     
    122111      cnum=`printf %08d $crun`
    123112      pnum=`printf %08d $prun`
    124       echo "calrun number: " $cnum >> $scriptlog 2>&1
    125       echo "pedrun number: " $pnum >> $scriptlog 2>&1
     113      printprocesslog "INFO calrun number: " $cnum
     114      printprocesslog "INFO pedrun number: " $pnum
    126115      #get all directories in the linked structure for the epoch
    127116      #dirs=`find $mcrawpath/ -mindepth 3 -maxdepth 3 -type d`
     
    142131         if ls $dir | grep MonteCarlo | grep $pnum
    143132         then
    144             echo "P run already there, do mysql update" >> $scriptlog 2>&1
     133            printprocesslog "INFO P run already there, do mysql update"
    145134   #         continue
    146135            mysql -ss -u $us --password=$pw --host=$ho $db -e " $pupdate "
    147136         else
    148             echo "linking P run for epoch $epo" >> $scriptlog 2>&1
    149             ln -sv $pedfile $newpedfile >> $scriptlog 2>&1
     137            printprocesslog "INFO linking P run for epoch $epo"
     138            ln -sv $pedfile $newpedfile
    150139            mysql -ss -u $us --password=$pw --host=$ho $db -e " $pupdate "
    151140         fi
     
    153142         if ls $dir | grep MonteCarlo | grep $cnum
    154143         then
    155             echo "C run already there, do mysql update" >> $scriptlog 2>&1
     144            printprocesslog "INFO C run already there, do mysql update"
    156145   #         continue
    157146            mysql -ss -u $us --password=$pw --host=$ho $db -e " $cupdate "
    158147         else
    159             echo "linking C run for epoch $epo" >> $scriptlog 2>&1
    160             ln -sv $calfile $newcalfile >> $scriptlog 2>&1
     148            printprocesslog "INFO linking C run for epoch $epo"
     149            ln -sv $calfile $newcalfile
    161150            mysql -ss -u $us --password=$pw --host=$ho $db -e " $cupdate "
    162151         fi
     
    211200
    212201
    213 finish >> $scriptlog 2>&1
    214 
     202finish
     203
Note: See TracChangeset for help on using the changeset viewer.