Changeset 7910 for trunk/MagicSoft/Mars/datacenter
- Timestamp:
- 08/22/06 15:08:12 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/datacenter/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck
r7909 r7910 28 28 # checked 29 29 # 30 # After checking, if the script is already running, the todolist is 31 # written 30 # Get todo file 32 31 # Then for each run the following steps are done: 33 32 # - filldotraw.C … … 40 39 # 41 40 41 source `dirname $0`/sourcefile 42 42 program=datacheck 43 source `dirname $0`/sourcefile43 column=fDataCheckDone 44 44 45 45 set -C 46 46 47 column=fDataCheckDone 48 49 lockfile=$lockpath/lock-getting-$program-list.txt 50 51 scriptlogpath=$logpath/run/$program/`date +%Y/%m` 47 scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d` 52 48 makedir $scriptlogpath 53 49 scriptlog=$scriptlogpath/$program-$datetime.log … … 55 51 date >> $scriptlog 2>&1 56 52 57 # check if there are already todo files58 echo "checking if other todo-files are there">> $scriptlog 2>&159 if ls $todofile-[1-9]*.txt >> $scriptlog 2>&153 # get todo file 54 possibletodofiles=`ls -r $listpath/ToDo-*-$column-*.txt` >> $scriptlog 2>&1 55 if [ "$possibletodofiles" = "" ] 60 56 then 61 echo " other file(s) on disk " >> $scriptlog 2>&162 echo " -> choose one file and start $program ">> $scriptlog 2>&157 echo "ERROR: in $program no todofiles found => something went wrong in jobmanager" 58 finish >> $scriptlog 2>&1 63 59 else 64 # check if getting of list is already running 65 checklock "getting list of" >> $scriptlog 2>&1 66 # get todo list 67 gettodolist >> $scriptlog 2>&1 68 rm -v $lockfile >> $scriptlog 2>&1 60 singleprocess="yes" 61 echo "todofiles: "${possibletodofiles[@]} >> $scriptlog 2>&1 62 for possibletodofile in ${possibletodofiles[@]} 63 do 64 if ! ls $possibletodofile >> $scriptlog 2>&1 65 then 66 echo "file is not on disk -> continue" >> $scriptlog 2>&1 67 continue 68 fi 69 lockfile=`echo $possibletodofile | sed -e 's/lists/locks/' -e 's/ToDo/lock/'` 70 checklock >> $scriptlog 2>&1 71 todofile=$possibletodofile 72 done 69 73 fi 70 71 72 # finding a todo file 73 nr=bla 74 echo "finding the right todo-file" >> $scriptlog 2>&1 75 todofiles=`ls -r $listpath/ToDo-$table-$column-*` 76 77 echo "todofiles: "${todofiles[@]} >> $scriptlog 2>&1 78 for todofile in ${todofiles[@]} 79 do 80 if ! ls $todofile >> $scriptlog 2>&1 81 then 82 echo "file is not on disk -> continue" >> $scriptlog 2>&1 83 continue 84 fi 85 lockfile=`echo $todofile | sed -e 's/lists/locks/' -e 's/ToDo/lock/'` 86 date > $lockfile >> $scriptlog 2>&1 87 checklock=$? 88 case $checklock in 89 0) echo "checklock=$checklock -> setting number" >> $scriptlog 2>&1 90 nr=${i} 91 break;; 92 1) echo "checklock=$checklock -> file exists -> continue" >> $scriptlog 2>&1;; 93 *) echo "checklock=$checklock -> something went completely wrong" >> $scriptlog 2>&1;; 94 esac 95 done 96 97 case $nr in 98 bla) echo "everything is beeing processed -> exit" >> $scriptlog 2>&1 99 date >> $scriptlog 2>&1 100 exit;; 101 12345678) echo "process nr: "$nr >> $scriptlog 2>&1;; 102 esac 103 74 if [ "$todofile" = "" ] 75 then 76 echo "no todofile found -> exit" >> $scriptlog 2>&1 77 finish >> $scriptlog 2>&1 78 fi 104 79 105 80 # get run(s) from todo file … … 125 100 echo "rawfile: "$rawfile >> $scriptlog 2>&1 126 101 date=`echo $rawfile | cut -c 22-31` 127 echo "date: "$date >> $scriptlog 2>&1128 102 # for sinope the date is needed in the format YYYY-MM-DD 129 103 date2=`echo $date | sed -e 's/\//-/g'` 130 echo "date2: "$date2 >> $scriptlog 2>&1 104 105 setstatus "start" >> $scriptlog 2>&1 131 106 132 107 # running filldotraw 108 echo "doing filldotraw..." >> $scriptlog 2>&1 133 109 filldotrawpath=$logpath/filldotraw/$date 134 110 makedir $filldotrawpath >> $scriptlog 2>&1 135 111 filldotrawlogfile=$filldotrawpath/filldotraw-$no2.log 136 112 137 echo "doing filldotraw..." >> $scriptlog 2>&1138 setstatus "start" >> $scriptlog 2>&1139 140 113 check1=`root -q -b $macrospath/filldotraw.C+\("\"$rawfile\""\,kFALSE\) | tee $filldotrawlogfile | grep int | sed -e 's/.*(int)//'` 141 114 142 115 case $check1 in 143 1) echo " check1=$check1 -> everything ok -> go on with $program..." >> $scriptlog 2>&1116 1) echo " check1=$check1 -> everything ok -> go on with $program..." >> $scriptlog 2>&1 144 117 ;; 145 0) echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1118 0) echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 146 119 check="no" 147 120 setstatus "stop" >> $scriptlog 2>&1 148 121 continue ;; 149 *) echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1122 *) echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1 150 123 com=$Ffillraw 151 124 check=$check1 … … 159 132 160 133 sins=( "-dat" "-cal") 161 echo ${sins[@]} >> $scriptlog 2>&1162 134 for sin in ${sins[@]} 163 135 do 164 136 sinopefile=sinope$sin$no2 165 echo $sinopefile >> $scriptlog 2>&1166 137 167 138 echo "running sinope $sin..." >> $scriptlog 2>&1 … … 170 141 171 142 case $check2 in 172 0) echo " check2=$check2 -> everything ok -> go on with $program..." >> $scriptlog 2>&1143 0) echo " check2=$check2 -> everything ok -> go on with $program..." >> $scriptlog 2>&1 173 144 ;; 174 *) echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1145 *) echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1 175 146 com=$Fsinope 176 147 # comadd= … … 191 162 192 163 case $check3 in 193 1) echo " check3=$check3 -> everything ok -> set status..." >> $scriptlog 2>&1164 1) echo " check3=$check3 -> everything ok -> set status..." >> $scriptlog 2>&1 194 165 ;; 195 0) echo " check3=$check3 -> no connection to db -> continue..." >> $scriptlog 2>&1166 0) echo " check3=$check3 -> no connection to db -> continue..." >> $scriptlog 2>&1 196 167 check="no" 197 168 setstatus "stop" >> $scriptlog 2>&1 198 169 continue ;; 199 *) echo " check3=$check3 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1170 *) echo " check3=$check3 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1 200 171 com=$Ffillsinope 201 172 check=$check3 … … 207 178 echo "resetting the status for fExclusionsDone for date $date2" >> $scriptlog 2>&1 208 179 resetlogpath=$logpath/resetexclusions/$date 209 echo "resetlogpath: $resetlogpath" >> $scriptlog 2>&1210 180 makedir $resetlogpath >> $scriptlog 2>&1 211 181 resetlog=$resetlogpath/reset-exclusions-$no2-$date2.log … … 213 183 check5=`root -q -b $macrospath/resetcolumn.C+\("\"fExclusionsDone\""\,"\"SequenceBuildStatus\""\,"\"$date2\""\,"\"$date2\""\,kFALSE\) | tee $resetlog | grep int | sed -e 's/(int)//'` 214 184 case $check5 in 215 1) echo " check5=$check5 -> everything ok, fExclusions have been reset " >> $scriptlog 2>&1185 1) echo " check5=$check5 -> everything ok, fExclusions have been reset " >> $scriptlog 2>&1 216 186 ;; 217 0) echo " check5=$check5 -> no connection to db -> continue..." >> $scriptlog 2>&1187 0) echo " check5=$check5 -> no connection to db -> continue..." >> $scriptlog 2>&1 218 188 check="no" 219 189 setstatus "stop" >> $scriptlog 2>&1 220 190 continue ;; 221 *) echo " check5=$check5 -> ERROR -> step could not be resetted -> repeat step " >> $scriptlog 2>&1191 *) echo " check5=$check5 -> ERROR -> step could not be resetted -> repeat step " >> $scriptlog 2>&1 222 192 com=$Fresetexcl 223 193 comadd=`echo $date2 | sed -e 's/-//g'` … … 228 198 229 199 # set status 230 echo "inserting the status for the $program for run $run into the db" >> $scriptlog 2>&1231 200 statustime="Now()" 232 201 failed="NULL" -
trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
r7909 r7910 113 113 } 114 114 115 # function to do continue in a loop or exit the program depending on what is needed 116 function contex() 117 { 118 echo "" 119 if [ "$singleprocess" = "yes" ] 120 then 121 continue 122 else 123 exit 124 fi 125 } 126 115 127 # function to make sure that a directory is made 116 128 function makedir() … … 133 145 checklock0=$? 134 146 case $checklock0 in 135 0) echo "checklock0=$checklock0 -> continue " ;; 136 1) echo "checklock0=$checklock0 -> file $lockfile exists " 137 echo "-> $@ $program is running -> exit" 147 0) echo " checklock0=$checklock0 -> continue " ;; 148 1) echo " checklock0=$checklock0 -> file $lockfile exists -> exit" 138 149 date 139 exit;;140 *) echo " checklock0=$checklock0 -> something went completely wrong" ;;150 contex;; 151 *) echo " checklock0=$checklock0 -> something went completely wrong" ;; 141 152 esac 142 153 } … … 158 169 159 170 case $check0 in 160 1) echo " check0=$check0 -> everything ok, got todo list -> run $program";;161 *) echo " check0=$check0 -> ERROR -> could not get todo list -> exit"171 1) echo " check0=$check0 -> everything ok, got todo list -> run $program";; 172 *) echo " check0=$check0 -> ERROR -> could not get todo list -> exit" 162 173 finish ;; 163 174 esac … … 194 205 resetstatusvalues 195 206 case $@ in 196 start) echo "s tart"207 start) echo "setstatus start" 197 208 starttime="Now()" 198 209 ;; 199 stop) echo "s top"210 stop) echo "setstatus stop" 200 211 case $check in 201 212 ok) echo " ok" … … 230 241 checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$var2\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$returncode\""\,"\"$failedcode\""\,"\"$failedcodeadd\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'` 231 242 case $checkstatus in 232 1) echo " checkstatus=$checkstatus -> everything ok, status has been set";;233 *) echo " checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"243 1) echo " checkstatus=$checkstatus -> everything ok, status has been set";; 244 *) echo " checkstatus=$checkstatus -> ERROR -> step could not be set -> exit" 234 245 finish ;; 235 246 esac … … 262 273 # echo " influences: $influences" 263 274 # echo " primary: $primary" 264 }265 266 function contex()267 {268 echo ""269 if [ "$singleprocess" = "yes" ]270 then271 continue272 else273 exit274 fi275 275 } 276 276
Note:
See TracChangeset
for help on using the changeset viewer.