1 | #!/bin/bash
|
---|
2 | #
|
---|
3 |
|
---|
4 | source `dirname $0`/../Sourcefile.sh
|
---|
5 | printprocesslog "INFO starting $0"
|
---|
6 | program=RunStar
|
---|
7 | step=Star
|
---|
8 |
|
---|
9 | set -C
|
---|
10 |
|
---|
11 | # get night and seqid
|
---|
12 | if [ "$night" = "" ] && [ "$seqid" = "" ]
|
---|
13 | then
|
---|
14 | # if no number are provided by JobManager
|
---|
15 | for (( i=0; i<100; i++ ))
|
---|
16 | do
|
---|
17 | # avoid too many simultaneous queries
|
---|
18 | sleep $(( ( RANDOM % 10 ) + 1 ))
|
---|
19 | # get todo list
|
---|
20 | gettodo "1"
|
---|
21 | echo ${primaries[@]}
|
---|
22 |
|
---|
23 | # get all needed variables
|
---|
24 | night=${primaries[0]}
|
---|
25 | seqid=${primaries[1]}
|
---|
26 | nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
|
---|
27 | seqnum=$night"_"`printf %03d $seqid`
|
---|
28 |
|
---|
29 | # check if script is already running
|
---|
30 | lockfile=$lockpath"/lock-"$program"-"$seqnum".txt"
|
---|
31 | checklock continue
|
---|
32 | printprocesslog "INFO got todo with try #"$i
|
---|
33 | break
|
---|
34 | done
|
---|
35 | else
|
---|
36 | nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
|
---|
37 | seqnum=$night"_"`printf %03d $seqid`
|
---|
38 | # check if script is already running
|
---|
39 | lockfile=$lockpath"/lock-"$program"-"$seqnum".txt"
|
---|
40 | checklock
|
---|
41 | s=0
|
---|
42 | primaries=( $night $seqid )
|
---|
43 | fi
|
---|
44 |
|
---|
45 | # get all needed paths and files
|
---|
46 | seqfile=$seqpath"/"$nightpath"/"$seqnum".seq"
|
---|
47 | inpath=$datapath"/callisto/"$nightpath
|
---|
48 | outpath=$datapath"/star/"$nightpath
|
---|
49 | makedir $outpath
|
---|
50 | logfile=$outpath"/"$seqnum"-images.log"
|
---|
51 |
|
---|
52 | cd $mars
|
---|
53 |
|
---|
54 | # set status in DB
|
---|
55 | # maybe already done in JobManager
|
---|
56 | # but do it again to have real runtime
|
---|
57 | setstatus "start"
|
---|
58 |
|
---|
59 | # run star
|
---|
60 | printprocesslog "INFO starting star.C for sequence "$seqnum
|
---|
61 |
|
---|
62 | #check1=`root -q -b fact/star.C\("\"$seqfile\""\,7.5\,3.9\,"\"$inpath\""\,"\"$outpath\""\) | tee $logfile | intgrep`
|
---|
63 | # new cleaning levels starting from version 2012.06.22
|
---|
64 | #check1=`root -q -b fact/analysis/star.C\("\"$seqfile\""\,4.0\,2.5\,"\"$inpath\""\,"\"$outpath\""\) | tee $logfile | intgrep`
|
---|
65 | # new cleaning levels for the new calibration
|
---|
66 | #check1=`root -q -b fact/analysis/star.C\("\"$seqfile\""\,5.2\,3.3\,"\"$inpath\""\,"\"$outpath\""\) | tee $logfile | intgrep`
|
---|
67 | # new cleaning
|
---|
68 | check1=`root -q -b fact/analysis/star.C\("\"$seqfile\""\,"\"$inpath\""\,"\"$outpath\""\) | tee $logfile | intgrep`
|
---|
69 |
|
---|
70 | case $check1 in
|
---|
71 | 0) printprocesslog "INFO star was successful for sequence "$seqnum" (check1=$check1)"
|
---|
72 | ;;
|
---|
73 | *) printprocesslog "ERROR star.C failed for sequence "$seqnum" (check1=$check1)"
|
---|
74 | check=$check1
|
---|
75 | ;;
|
---|
76 | esac
|
---|
77 |
|
---|
78 | # run merpp
|
---|
79 | printprocesslog "INFO starting merpp3.C for sequence "$seqnum
|
---|
80 | logfile=$outpath"/"$seqnum"-merpp.log"
|
---|
81 |
|
---|
82 | check1=`root -q -b fact/analysis/merpp.C\("\"$seqfile\""\,"\"$outpath\""\) | tee $logfile | intgrep`
|
---|
83 |
|
---|
84 | case $check1 in
|
---|
85 | 0) printprocesslog "INFO merpp was successful for sequence "$seqnum" (check1=$check1)"
|
---|
86 | ;;
|
---|
87 | *) printprocesslog "ERROR merpp.C failed for sequence "$seqnum" (check1=$check1)"
|
---|
88 | check=10$check1
|
---|
89 | ;;
|
---|
90 | esac
|
---|
91 |
|
---|
92 | setstatus "stop"
|
---|
93 |
|
---|
94 | finish
|
---|
95 |
|
---|