| 1 | #!/bin/bash
|
|---|
| 2 | #
|
|---|
| 3 |
|
|---|
| 4 | source `dirname $0`/../Sourcefile.sh
|
|---|
| 5 | printprocesslog "INFO starting $0"
|
|---|
| 6 | program=BuildSequences
|
|---|
| 7 |
|
|---|
| 8 | # removed, as this is taken care of in crontab
|
|---|
| 9 | #set -C
|
|---|
| 10 | ## check if script is already running
|
|---|
| 11 | #lockfile=$lockpath/lock-$program.txt
|
|---|
| 12 | #checklock
|
|---|
| 13 |
|
|---|
| 14 | logfile=$runlogpath"/BuildSequences-"$datetime".log"
|
|---|
| 15 | date >> $logfile
|
|---|
| 16 |
|
|---|
| 17 | cd $mars
|
|---|
| 18 |
|
|---|
| 19 | check1=`root -q -b fact/processing/buildseqentries.C+\("\"$datapath\""\,"\"$seqpath\""\,1\,kFALSE\) | tee $logfile | intgrep`
|
|---|
| 20 |
|
|---|
| 21 | case $check1 in
|
|---|
| 22 | 1) printprocesslog "INFO built sequences was successfully (check1=$check1)"
|
|---|
| 23 | ;;
|
|---|
| 24 | 0) printprocesslog "WARN connection to DB failed (check1=$check1)"
|
|---|
| 25 | #check="no"
|
|---|
| 26 | ;;
|
|---|
| 27 | *) printprocesslog "ERROR buildseqentries.C failed (check1=$check1)"
|
|---|
| 28 | #check=$check1
|
|---|
| 29 | ;;
|
|---|
| 30 | esac
|
|---|
| 31 |
|
|---|
| 32 | # update run counts in SequenceInfo table
|
|---|
| 33 | # runs in sequence
|
|---|
| 34 | query="UPDATE SequenceInfo LEFT JOIN RunInfo USING(fNight, fSequenceID) "
|
|---|
| 35 | query=$query"SET fNumRuns=(SELECT COUNT(*) FROM RunInfo "
|
|---|
| 36 | query=$query"WHERE fSequenceID=SequenceInfo.fSequenceID AND fNight=SequenceInfo.fNight) "
|
|---|
| 37 | printprocesslog "INFO Updating SequenceInfo with number of runs."
|
|---|
| 38 | sendquery >> $logfile
|
|---|
| 39 | # raw files avail ISDC
|
|---|
| 40 | query="UPDATE SequenceInfo LEFT JOIN RunInfo USING(fNight, fSequenceID) "
|
|---|
| 41 | query=$query"SET fNumRawfilesAvailISDC=(SELECT COUNT(*) FROM RunInfo "
|
|---|
| 42 | query=$query"LEFT JOIN RawFileAvailISDCStatus USING(fNight, fRunID) "
|
|---|
| 43 | query=$query"WHERE fSequenceID=SequenceInfo.fSequenceID AND fNight=SequenceInfo.fNight "
|
|---|
| 44 | query=$query"AND NOT ISNULL(RawFileAvailISDCStatus.fStartTime) "
|
|---|
| 45 | query=$query"AND NOT ISNULL(RawFileAvailISDCStatus.fStopTime) "
|
|---|
| 46 | query=$query"AND ISNULL(RawFileAvailISDCStatus.fReturnCode)) "
|
|---|
| 47 | printprocesslog "INFO Updating SequenceInfo with number of available files."
|
|---|
| 48 | sendquery >> $logfile
|
|---|
| 49 |
|
|---|
| 50 | finish
|
|---|
| 51 |
|
|---|