source: trunk/DataCheck/Processing/BuildSequences.sh@ 19975

Last change on this file since 19975 was 18759, checked in by Daniela Dorner, 8 years ago
improved logging
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/bin/bash
2#
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6program=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
14logfile=$runlogpath"/BuildSequences-"$datetime".log"
15date >> $logfile
16
17cd $mars
18
19check1=`root -q -b fact/processing/buildseqentries.C+\("\"$datapath\""\,"\"$seqpath\""\,1\,kFALSE\) | tee $logfile | intgrep`
20
21case $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 ;;
30esac
31
32# update run counts in SequenceInfo table
33# runs in sequence
34query="UPDATE SequenceInfo LEFT JOIN RunInfo USING(fNight, fSequenceID) "
35query=$query"SET fNumRuns=(SELECT COUNT(*) FROM RunInfo "
36query=$query"WHERE fSequenceID=SequenceInfo.fSequenceID AND fNight=SequenceInfo.fNight) "
37printprocesslog "INFO Updating SequenceInfo with number of runs."
38sendquery >> $logfile
39# raw files avail ISDC
40query="UPDATE SequenceInfo LEFT JOIN RunInfo USING(fNight, fSequenceID) "
41query=$query"SET fNumRawfilesAvailISDC=(SELECT COUNT(*) FROM RunInfo "
42query=$query"LEFT JOIN RawFileAvailISDCStatus USING(fNight, fRunID) "
43query=$query"WHERE fSequenceID=SequenceInfo.fSequenceID AND fNight=SequenceInfo.fNight "
44query=$query"AND NOT ISNULL(RawFileAvailISDCStatus.fStartTime) "
45query=$query"AND NOT ISNULL(RawFileAvailISDCStatus.fStopTime) "
46query=$query"AND ISNULL(RawFileAvailISDCStatus.fReturnCode)) "
47printprocesslog "INFO Updating SequenceInfo with number of available files."
48sendquery >> $logfile
49
50finish
51
Note: See TracBrowser for help on using the repository browser.