1 |
#! /bin/csh -f |
2 |
# set echo |
3 |
|
4 |
# echo starting $0 $* |
5 |
|
6 |
if ($?WORKFLOW_ROOT) then |
7 |
set WFDIR = $WORKFLOW_DATA |
8 |
set WFCODE = $WORKFLOW_ROOT |
9 |
else |
10 |
echo Need WORKFLOW_ROOT variable to be set. |
11 |
exit 1 |
12 |
endif |
13 |
|
14 |
cd $WFDIR/gates |
15 |
set gate = $1 |
16 |
cd $gate |
17 |
|
18 |
set product = `cat product` |
19 |
set key = `cat key` |
20 |
set low = `cat low` |
21 |
set high = `cat high` |
22 |
set keytype = `cat type` |
23 |
set nancount = 0 |
24 |
|
25 |
# set echo |
26 |
|
27 |
if ($low == "NaN") then |
28 |
set nancount = 1 |
29 |
if (`show_info -iq $product n=1 | wc -l` <= 0) then |
30 |
echo $0 $* status of $product Empty Series |
31 |
echo "-1" > low |
32 |
echo "-1" > high |
33 |
set STATUS = 0 |
34 |
goto EXITPLACE |
35 |
endif |
36 |
if ($keytype == time) then |
37 |
show_info -q $product'[? $key > 0 ?] n=1' key=$key > low |
38 |
if ($?) then |
39 |
echo $0 $* FAILED |
40 |
set STATUS = 1 |
41 |
goto EXITPLACE |
42 |
endif |
43 |
else |
44 |
show_info -q $product'[^]' key=$key > low |
45 |
if ($?) then |
46 |
echo $0 $* FAILED |
47 |
set STATUS = 1 |
48 |
goto EXITPLACE |
49 |
endif |
50 |
endif |
51 |
set nlow = `wc -c <low` |
52 |
if ($nlow == 0) then # There are no records in the series |
53 |
echo "-1" > low |
54 |
echo "-1" > high |
55 |
set STATUS = 0 |
56 |
goto EXITPLACE |
57 |
endif |
58 |
endif |
59 |
set low = `cat low` |
60 |
|
61 |
if ($high == "NaN") @ nancount = $nancount + 1 |
62 |
|
63 |
show_info -q $product'[$]' key=$key > high |
64 |
if ($?) then |
65 |
echo $0 $* FAILED |
66 |
set STATUS = 1 |
67 |
goto EXITPLACE |
68 |
endif |
69 |
|
70 |
# if ($#argv < 2) then |
71 |
# set nhigh = `wc -c <high` |
72 |
# if ($nhigh == 0) then # There are no records in the series |
73 |
# echo #### SETTING -1 where product=$product and show_info call gives: |
74 |
# show_info -q $product'[$]' key=$key |
75 |
# echo "-1" > low |
76 |
# echo "-1" > high |
77 |
# set STATUS = 0 |
78 |
# goto EXITPLACE |
79 |
# endif |
80 |
# endif |
81 |
|
82 |
set high = `cat high` |
83 |
|
84 |
# unset echo |
85 |
|
86 |
if ($#argv > 1) then # get coverage map |
87 |
set minlow = $low |
88 |
set maxhigh = $high |
89 |
set miscargs |
90 |
shift |
91 |
while ($#argv > 0) |
92 |
if ($1 =~ "low=*") then |
93 |
set $1 |
94 |
else if ($1 =~ "high=*") then |
95 |
set $1 |
96 |
else |
97 |
set miscargs = "$miscargs $1" |
98 |
endif |
99 |
shift |
100 |
end |
101 |
if ($nancount == 2) then |
102 |
show_coverage ds=$product low=$minlow high=$maxhigh -iq $miscargs > coverage |
103 |
else |
104 |
show_coverage ds=$product low=$low high=$high -iq $miscargs |
105 |
endif |
106 |
|
107 |
endif |
108 |
|
109 |
set STATUS = 0 |
110 |
EXITPLACE: |
111 |
set nowtxt = `date -u +%Y.%m.%d_%H:%M:%S` |
112 |
echo $nowtxt > lastupdate |
113 |
|
114 |
rm -f statusbusy |
115 |
exit $STATUS |