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

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