source: trunk/DataCheck/QuickLook/RunCallisto.sh@ 18070

Last change on this file since 18070 was 18070, checked in by Daniela Dorner, 10 years ago
improved logging, added second try of callisto in case first fails
  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/bin/bash
2#
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6
7logfile=$2
8
9# make sure that no other RunCallisto.sh is started for this run
10touch $logfile
11
12cd $mars
13
14# check how many callistos are running
15callistocount=`ps aux | grep callisto_ | grep -E -o '20[12][0-9][01][0-9][0-3][0-9]_[0-9][0-9][0-9]' | sort | uniq | wc -l`
16
17while [ $callistocount -ge $numcallistos ]
18do
19 source `dirname $0`/../Sourcefile.sh
20 printprocesslog "INFO wait "$callistowait" as "$callistocount" callistos running ( "$numcallistos" allowed). "
21 sleep $callistowait
22 callistocount=`ps aux | grep callisto_ | grep -E -o '20[12][0-9][01][0-9][0-3][0-9]_[0-9][0-9][0-9]' | sort | uniq | wc -l`
23done
24
25case $1 in
26 drun) # process data run
27 # run callisto
28 printprocesslog "DEBUG fact/analysis/callisto_data.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"\""\,"\"$6\""\) | tee $logfile "
29 check1=`root -q -b fact/analysis/callisto_data.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"\""\,"\"$6\""\) | tee $logfile | intgrep`
30 ;;
31 prun) # process pedestal run
32 printprocesslog "DEBUG fact/analysis/callisto_pedestal.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile "
33 check1=`root -q -b fact/analysis/callisto_pedestal.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile | intgrep`
34 ;;
35 crun) # process light-pulser run
36 printprocesslog "DEBUG fact/analysis/callisto_lightpulser.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"$6\""\) | tee $logfile "
37 check1=`root -q -b fact/analysis/callisto_lightpulser.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"$6\""\) | tee $logfile | intgrep`
38 ;;
39 time) # do drs-calib
40 printprocesslog "DEBUG fact/analysis/callisto_drstime.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile "
41 check1=`root -q -b fact/analysis/callisto_drstime.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile | intgrep`
42 ;;
43 *) # default
44 printprocesslog "WARN wrong parameter given to script RunCallisto.sh :"$1
45 ;;
46esac
47
48case $check1 in
49 0) printprocesslog "INFO callisto was successful for file "$3" (check1=$check1)"
50 if [ "$1" == "drun" ]
51 then
52 printprocesslog "INFO start RunStar.sh for file "$7
53 starfile=`echo $7 | sed -e 's/callisto/star/g' -e 's/_C/_I/'`
54 starlog=`echo $starfile | sed -e 's/_I.root/-images.log/'`
55 outpath=`dirname $starfile`
56 makedir $outpath
57 `dirname $0`/RunStar.sh $starlog $7 $outpath $starfile
58 fi
59 ;;
60 *) printprocesslog "ERROR callisto failed for file "$3" (check1=$check1)"
61 # allow for reprocessing in case callisto fails once
62 cplogfile=$logfile.cp
63 if ! ls $cplogfile >/dev/null
64 then
65 mv $logfile $cplogfile
66 fi
67 ;;
68esac
69
70finish
71
Note: See TracBrowser for help on using the repository browser.