Changeset 9355 for trunk/MagicSoft/Mars/datacenter/scripts/fillcamera
- Timestamp:
- 02/19/09 21:22:19 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/fillcamera
r9217 r9355 1 #!/bin/sh1 #!/bin/sh 2 2 # 3 3 # ======================================================================== … … 35 35 set -C 36 36 37 scriptlog=$runlogpath/$program-$datetime.log38 date >> $scriptlog 2>&139 40 37 # check if script is already running 41 38 lockfile=$lockpath/lock-$program.txt 42 checklock >> $scriptlog 2>&139 checklock 43 40 44 41 getdbsetup … … 48 45 #workaround 49 46 cameradirs=`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 47 printprocesslog "INFO camera dirs: "${cameradirs[@]} 52 48 53 49 cd $mars … … 66 62 fi 67 63 epo=`echo $cameradir | cut -d/ -f5` #epoch 68 echo "dir: "$cameradir >> $scriptlog 2>&164 printprocesslog "INFO dir: "$cameradir 69 65 fillcamerapath=$logpath/$program 70 makedir $fillcamerapath >> $scriptlog 2>&166 makedir $fillcamerapath 71 67 fillcameralog=$fillcamerapath/$program-$epo-$par-$spot-$cam.log 72 68 … … 74 70 # check0=`root -q -b $macrospath/fillcamera.C+\("\"$cameradir\""\,kTRUE\) | tee $fillcameralog | intgrep` 75 71 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)" 78 73 ;; 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)" 81 75 check="no" 82 76 ;; 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)" 85 78 ;; 86 79 esac 87 80 88 81 printprocesslog "INFO linking cal and ped files" 89 echo "linking cal and ped files" >> $scriptlog 2>&190 82 91 83 if [ $cam = "Cal_and_Ped" ]; 92 84 then 93 echo "Cal_and_Ped folder, no cal and ped files will be linked" >> $scriptlog 2>&185 printprocesslog "INFO Cal_and_Ped folder, no cal and ped files will be linked" 94 86 else 95 87 … … 99 91 calfile=`find $mccampath/$epo/Cal_and_Ped -name *_C_*.root` 100 92 101 echo "calfile for epoch $epo : " $calfile >> $scriptlog 2>&1102 echo "pedfile for epoch $epo : " $pedfile >> $scriptlog 2>&193 printprocesslog "INFO calfile for epoch $epo : " $calfile 94 printprocesslog "INFO pedfile for epoch $epo : " $pedfile 103 95 104 96 #check number of files … … 107 99 if [ "$numfiles" != "2" ] 108 100 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 114 103 fi 115 104 … … 122 111 cnum=`printf %08d $crun` 123 112 pnum=`printf %08d $prun` 124 echo "calrun number: " $cnum >> $scriptlog 2>&1125 echo "pedrun number: " $pnum >> $scriptlog 2>&1113 printprocesslog "INFO calrun number: " $cnum 114 printprocesslog "INFO pedrun number: " $pnum 126 115 #get all directories in the linked structure for the epoch 127 116 #dirs=`find $mcrawpath/ -mindepth 3 -maxdepth 3 -type d` … … 142 131 if ls $dir | grep MonteCarlo | grep $pnum 143 132 then 144 echo "P run already there, do mysql update" >> $scriptlog 2>&1133 printprocesslog "INFO P run already there, do mysql update" 145 134 # continue 146 135 mysql -ss -u $us --password=$pw --host=$ho $db -e " $pupdate " 147 136 else 148 echo "linking P run for epoch $epo" >> $scriptlog 2>&1149 ln -sv $pedfile $newpedfile >> $scriptlog 2>&1137 printprocesslog "INFO linking P run for epoch $epo" 138 ln -sv $pedfile $newpedfile 150 139 mysql -ss -u $us --password=$pw --host=$ho $db -e " $pupdate " 151 140 fi … … 153 142 if ls $dir | grep MonteCarlo | grep $cnum 154 143 then 155 echo "C run already there, do mysql update" >> $scriptlog 2>&1144 printprocesslog "INFO C run already there, do mysql update" 156 145 # continue 157 146 mysql -ss -u $us --password=$pw --host=$ho $db -e " $cupdate " 158 147 else 159 echo "linking C run for epoch $epo" >> $scriptlog 2>&1160 ln -sv $calfile $newcalfile >> $scriptlog 2>&1148 printprocesslog "INFO linking C run for epoch $epo" 149 ln -sv $calfile $newcalfile 161 150 mysql -ss -u $us --password=$pw --host=$ho $db -e " $cupdate " 162 151 fi … … 211 200 212 201 213 finish >> $scriptlog 2>&1214 202 finish 203
Note:
See TracChangeset
for help on using the changeset viewer.