Changeset 7944 for trunk/MagicSoft/Mars/datacenter/scripts/filesondisk
- Timestamp:
- 08/25/06 22:09:49 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/filesondisk
r7938 r7944 46 46 47 47 source `dirname $0`/sourcefile 48 printprocesslog "INFO starting $0" 49 program=filesondisk 48 50 49 51 set -C 50 52 51 cd $mars 52 53 program=filesondisk 54 55 lockfile=$lockpath/lock-$program.txt 56 57 scriptlogpath=$runlogpath/$program 58 makedir $scriptlogpath 59 scriptlog=$scriptlogpath/$program-$datetime.log 60 53 scriptlog=$runlogpath/$program-$datetime.log 61 54 date >> $scriptlog 2>&1 62 55 63 56 # check if script is already running 57 lockfile=$lockpath/lock-$program.txt 64 58 checklock >> $scriptlog 2>&1 65 59 66 date=`date +%F` 60 filesondisklogpath=$logpath/$program/`date +%Y/%m` 61 makedir $filesondisklogpath >> $scriptlog 2>&1 67 62 68 subsystemdir=/magic/subsystemdata 69 filesondisklogpath=$logpath/$program/`date +%Y/%m` 70 makedir $filesondisklogpath 71 63 cd $mars 72 64 73 65 echo "checking disk for ccfiles..." >> $scriptlog 2>&1 66 printprocesslog "INFO checking ccfiles" 74 67 filename=$filesondisklogpath/ccfilesondisk-$datetime.txt 75 68 column=fCCFileAvail 76 find $subsystem dir/cc/ -name '*_S.rep' | cut -d_ -f2 > $filename69 find $subsystempath/cc/ -name '*_S.rep' | cut -d_ -f2 > $filename 77 70 78 71 echo "resetting runs..." >> $scriptlog 2>&1 … … 80 73 81 74 case $check3 in 82 1) echo "check3=$check3 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;; 83 *) echo "check3=$check3 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;; 75 1) echo " check3=$check3 -> everything ok -> reset is done" >> $scriptlog 2>&1 76 printprocesslog "INFO ccfiles resetted successfully" 77 ;; 78 0) echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 79 printprocesslog "WARN connection to DB failed" 80 ;; 81 *) echo " check3=$check3 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 82 printprocesslog "ERROR resettallruns.C failed for ccfiles" 83 ;; 84 84 esac 85 85 86 86 87 87 echo "checking disk for cacofiles..." >> $scriptlog 2>&1 88 printprocesslog "INFO checking cacofiles" 88 89 filename=$filesondisklogpath/cacofilesondisk-$datetime.txt 89 90 column=fCaCoFileAvail 90 find $subsystem dir/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename91 find $subsystempath/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename 91 92 92 93 echo "resetting runs..." >> $scriptlog 2>&1 … … 94 95 95 96 case $check0 in 96 1) echo "check0=$check0 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;; 97 *) echo "check0=$check0 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;; 97 1) echo " check0=$check0 -> everything ok -> reset is done" >> $scriptlog 2>&1 98 printprocesslog "INFO cacofiles resetted successfully" 99 ;; 100 0) echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 101 printprocesslog "WARN connection to DB failed" 102 ;; 103 *) echo " check0=$check0 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 104 printprocesslog "ERROR resettallruns.C failed for cacofiles" 105 ;; 98 106 esac 99 107 108 date=`date +%F` 100 109 echo "checking missing cacofiles..." >> $scriptlog 2>&1 110 printprocesslog "INFO checking missing cacofiles" 101 111 check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\,"\"$filesondisklogpath\""\) | tee $filesondisklogpath/findcacofiles-$datetime.log | grep int | sed -e 's/(int)//'` 102 112 103 113 case $check1 in 104 1) echo "check1=$check1 -> everything ok -> missing cacofiles are found" >> $scriptlog 2>&1 ;; 105 *) echo "check1=$check1 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;; 114 1) echo " check1=$check1 -> everything ok -> missing cacofiles are found" >> $scriptlog 2>&1 115 printprocesslog "INFO missing cacofiles found" 116 ;; 117 0) echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 118 printprocesslog "WARN connection to DB failed" 119 ;; 120 *) echo " check1=$check1 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 121 printprocesslog "ERROR findcacofiles.C failed" 122 ;; 106 123 esac 107 124 125 printprocesslog "INFO finding missing cacofiles" 108 126 missingcacoruns=(`cat $filesondisklogpath/findcacofiles-$date.txt`) 109 127 for missingcacorun in ${missingcacoruns[@]} … … 112 130 echo "missing cacofile for run "$runno >> $scriptlog 2>&1 113 131 echo "-> finding cacofile" >> $scriptlog 2>&1 114 ccfile=`find $subsystem dir/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep` 2>/dev/null132 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` 2>/dev/null 115 133 echo " ccfile: "$ccfile >> $scriptlog 2>&1 116 134 if [ "$ccfile" = "" ] … … 129 147 continue 130 148 else 149 printprocesslog "INFO inserting cacofile for run $missingcacorun" 131 150 echo " inserting cacofile $file for run $missingcacorun..." >> $scriptlog 2>&1 132 151 check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | grep int | sed -e 's/(int)//'` 133 152 134 153 case $check2 in 135 1) echo " check2=$check2 -> everything ok -> insert is done" >> $scriptlog 2>&1 ;; 136 *) echo " check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun >> $scriptlog 2>&1 ;; 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 ;; 137 163 esac 138 164 break … … 142 168 then 143 169 echo " no cacofile found for run "$runno >> $scriptlog 2>&1 170 printprocesslog "WARN no cacofile found for run $runno" 144 171 else 145 172 echo " cacofile: "$cacofile >> $scriptlog 2>&1 … … 149 176 150 177 echo "checking disk for rawfiles..." >> $scriptlog 2>&1 178 printprocesslog "INFO checking rawfiles" 151 179 filename=$filesondisklogpath/rawfilesondisk-$datetime.txt 152 180 column=fRawFileAvail 153 find $datapath -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename181 find $datapath/rawfiles -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename 154 182 155 183 echo "resetting runs..." >> $scriptlog 2>&1 … … 157 185 158 186 case $check4 in 159 1) echo "check4=$check4 -> everything ok -> reset is done" >> $scriptlog 2>&1 ;; 160 *) echo "check4=$check4 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 ;; 187 1) echo " check4=$check4 -> everything ok -> reset is done" >> $scriptlog 2>&1 188 printprocesslog "INFO rawfiles resetted successfully" 189 ;; 190 0) echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 191 printprocesslog "WARN connection to DB failed" 192 ;; 193 *) echo " check4=$check4 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1 194 printprocesslog "ERROR resettallruns.C failed for rawfiles" 195 ;; 161 196 esac 162 197 163 198 finish >> $scriptlog 2>&1 164 199 165
Note:
See TracChangeset
for help on using the changeset viewer.