Changeset 9456 for trunk/MagicSoft/Mars/datacenter
- Timestamp:
- 06/12/09 14:15:47 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
r9400 r9456 56 56 then 57 57 echo "could not make dir "$@ 58 if ! [ "$processlog" = "" ] 59 then 60 echo `date +%F\ %T`" "`whoami`"@"$HOSTNAME" "`basename $0`"["$$"] could not make dir "$@ >> $processlog 61 fi 58 62 if ls $lockfile >/dev/null 2>&1 59 63 then … … 133 137 Fmcstar=31 134 138 Ffillmcstar=32 139 Fcorsikasimtel=33 140 Fchimp=34 141 Fchimpcp=35 142 Fctastar=36 143 Fctastarcp=37 144 FctastereoA=38 145 FctastereoB=39 146 FctastereoC=40 147 FctastereoD=41 148 FctastereoE=42 149 FctastereoF=43 150 FctastereoG=44 151 FctastereoH=45 152 Fctastereocp=46 135 153 136 154 # setup for jobmanager: … … 165 183 alias 'intgrep'='grep -E -o \\\(int\\\)[0-9]+$ | grep -E -o [0-9]+' 166 184 185 167 186 # in the following the functions, which are needed by several scripts, are 168 187 # defined … … 177 196 178 197 # function to check if a process is already locked 198 # command line option can be used to execute something, e.g. 'continue' 179 199 function checklock() 180 200 { 181 date > $lockfile 182 checklock0=$? 183 case $checklock0 in 184 0) printprocesslog "INFO checklock0=$checklock0 -> continue " 185 ;; 186 1) printprocesslog "WARN checklock0=$checklock0 -> file $lockfile exists" 187 $@ 188 exit;; 189 *) printprocesslog "ERROR checklock0=$checklock0 -> something went completely wrong" ;; 190 esac 201 if ! echo `date +%F\ %T`" "`whoami`"@"$HOSTNAME" "`basename $0`"["$$"] "`uname -a` > $lockfile 2>/dev/null 202 then 203 printprocesslog "WARN lockfile $lockfile exists" 204 $@ 205 exit 206 else 207 printprocesslog "INFO created lockfile $lockfile" 208 fi 191 209 } 192 210 … … 280 298 getstepinfo 281 299 # get query 282 query=" select"${prims[0]}300 query=" SELECT "${prims[0]} 283 301 for (( i=1 ; i < ${#prims[@]} ; i++ )) 284 302 do 285 303 query=$query", ${prims[$i]}" 286 304 done 287 query=$query" from $table where"305 query=$query" FROM $table WHERE " 288 306 if ! echo $needs | grep '#' > /dev/null 289 307 then 290 308 for need in $needs 291 309 do 292 query=$query" not isnull($need) and"310 query=$query" NOT ISNULL($need) AND" 293 311 done 294 312 fi 295 query=$query" isnull($column) " 296 query=$query" and isnull(fStartTime) and isnull(fFailedTime) and isnull(fProgramId) and isnull(fReturnCode) " 297 query=$query" order by fPriority desc " 298 if [ "$@ " != " " ] 313 query=$query" ISNULL($column) " 314 if [ "$2 " != " " ] 299 315 then 300 query=$query" limit 0, $@ " 301 fi 302 printprocesslog "INFO QUERY: "$query 316 query=$query" AND fProductionHostKEY=$2 " 317 fi 318 query=$query" AND ISNULL(fStartTime) AND ISNULL(fFailedTime) AND ISNULL(fProgramId) AND ISNULL(fReturnCode) " 319 query=$query" ORDER BY fPriority desc " 320 if [ "$1 " != " " ] 321 then 322 query=$query" limit 0, $1 " 323 fi 324 # echo " QUERY: "$query 325 printprocesslog "INFO gettodo QUERY: "$query 303 326 if ! process=`mysql -s -u $us --password=$pw --host=$ho $db -e " $query "` 304 327 then … … 325 348 getstepinfo 326 349 # get query 327 query=" select count(*) from $table where"350 query=" SELECT COUNT(*) FROM $table WHERE " 328 351 if ! echo $needs | grep '#' > /dev/null 329 352 then 330 353 for need in $needs 331 354 do 332 query=$query" not isnull($need) and"355 query=$query" NOT ISNULL($need) AND" 333 356 done 334 357 fi 335 query=$query" isnull($column) " 336 query=$query" and isnull(fStartTime) and isnull(fFailedTime) and isnull(fProgramId) and isnull(fReturnCode) " 337 query=$query" group by $column " 338 # printprocesslog "INFO QUERY: "$query 358 query=$query" ISNULL($column) " 359 if [ "$1 " != " " ] 360 then 361 query=$query" AND fProductionHostKEY=$1 " 362 fi 363 query=$query" AND ISNULL(fStartTime) AND ISNULL(fFailedTime) AND ISNULL(fProgramId) AND ISNULL(fReturnCode) " 364 query=$query" GROUP BY $column " 365 # echo "QUERY: "$query 366 printprocesslog "INFO getstatus QUERY: "$query 339 367 if ! numproc=`mysql -s -u $us --password=$pw --host=$ho $db -e " $query "` 340 368 then … … 383 411 for (( i=1 ; i < ${#prims[@]} ; i++ )) 384 412 do 385 query=$query" and${prims[$i]}='${primaries[$s*${#prims[@]}+$i]}' "413 query=$query" AND ${prims[$i]}='${primaries[$s*${#prims[@]}+$i]}' " 386 414 done 387 printprocesslog "INFO QUERY: "$query 415 # echo " QUERY: "$query 416 printprocesslog "INFO setstatus QUERY: "$query 388 417 if ! mysql -s -u $us --password=$pw --host=$ho $db -e " $query " 389 418 then … … 398 427 { 399 428 getdbsetup 429 printprocesslog "INFO sendquery QUERY: "$query 400 430 if ! val=`mysql -s -u $us --password=$pw --host=$ho $db -e " $query "` 401 431 then
Note:
See TracChangeset
for help on using the changeset viewer.