source: trunk/DataCheck/QuickLook/Step2a.sh@ 19007

Last change on this file since 19007 was 18684, checked in by Daniela Dorner, 8 years ago
improved logging
  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/bin/bash
2#
3source `dirname $0`/../Sourcefile.sh
4printprocesslog "INFO starting $0"
5
6# get dates
7if [ "$certaindate" != "" ]
8then
9 getdates $certaindate
10else
11 if [ "$1" = "" ]
12 then
13 # get all night
14 #getdates "all"
15 # get last 6 nights if hour between 7 and 19h, else only current night
16 getdates 6 7 19
17 else
18 getdates $1
19 fi
20fi
21
22
23
24for date in ${dates[@]}
25do
26 printprocesslog "INFO processing "$date
27 if [ "$certaindate" != "" ]
28 then
29 echo "INFO processing "$date
30 fi
31 night=`echo $date | sed -e 's/\///g'`
32
33 numganymeds=0
34 # getting all image files for this night
35 printprocesslog "INFO get file list for night "$date
36 files=( `find $anapath/star/$date -type f -name '*_I.root' 2>/dev/null | sort` )
37 if [ ${#files[@]} -eq 0 ]
38 then
39 printprocesslog "INFO no image files available for night "$date
40 continue
41 fi
42
43 for file in ${files[@]}
44 do
45 night=`basename $file | cut -d_ -f1`
46 run=`basename $file | cut -d_ -f2`
47 printprocesslog "INFO processing run "$run
48 #echo "INFO processing run "$run
49 # process only if merpp-log is available to make sure that star-file is complete
50 # at ISDC seq# != run# -> get seq#
51 if echo $resulttable1 | grep ISDC >/dev/null 2>&1
52 then
53 query="SELECT LPAD(fSequenceID, 3, 0) FROM RunInfo WHERE fNight="$night" AND fRunID="$run
54 seq=`sendquery`
55 merpplog=`dirname $file`"/"$night"_"$seq"-merpp.log"
56 else
57 merpplog=`echo $file | sed -e 's/_I.root/-merpp.log/'`
58 fi
59 # check if merpp is finished
60 stillrunning=`find $merpplog -mmin -1 2>/dev/null`
61 if ! [ -e $merpplog ] || [ "$stillrunning" != "" ]
62 then
63 printprocesslog "INFO merpp still running - wait with file "$file
64 continue
65 fi
66 # process only if ganymedlogfiles is not yet there
67 logfile=`echo $file | sed -e 's/star/ganymed_run/' -e 's/_I[.]root/-ganymed[.]log/'`
68 if ! ls $logfile >/dev/null 2>&1
69 then
70 printprocesslog "DEBUG `dirname $0`/RunGanymed.sh "$file
71 if [ "$qlasge" = "yes" ]
72 then
73 printprocesslog "$sgepath/qsub -b y -q fact_short -v AUTOMATIONSETUP=$AUTOMATIONSETUP -v starfile=$file -e bla.txt -o bla.txt `dirname $0`/RunGanymed.sh"
74 $sgepath/qsub -b y -q fact_short -v AUTOMATIONSETUP=$AUTOMATIONSETUP -v starfile=$file -e bla.txt -o bla.txt `dirname $0`/RunGanymed.sh | grep -v 'has been submitted'
75 else
76 printprocesslog " INFO `dirname $0`/RunGanymed.sh $file"
77 `dirname $0`/RunGanymed.sh $file
78 if [ "$certaindate" != "" ]
79 then
80 echo "ganymed for "$file
81 fi
82 fi
83 numganymeds=`echo " $numganymeds + 1 " | bc -l`
84 fi
85 done
86 printprocesslog "INFO found "$numganymeds" ganymeds."
87done
88
89finish
90
Note: See TracBrowser for help on using the repository browser.