1 phil 1.1 #! /bin/csh -f
2
3 # set echo
4
5 @ fourdays = 4 * 1440
6 @ fivedays = 5 * 1440
7 @ sixdays = 6 * 1440
8 @ oneweek = 7 * 1440
9
10 set hproduct = (lev1_nrt V_45s_nrt V_720s_nrt lev1 cosmic_rays V_45s V_720s)
11 set product = (lev0 $hproduct)
12 set green = ( 2 5 30 48 $fourdays $fourdays $fivedays $fivedays)
13 set yellow = ( 4 10 60 80 $fivedays $fivedays $sixdays $sixdays)
14 set red = ( 8 20 120 150 $sixdays $sixdays $oneweek $oneweek)
15
16 set now = `date -u +%Y.%m.%d_%H:%M:%S`
17 set now_t = `time_convert time=$now`
18
19 set nprod = $#product
20 set iprod = 1
21 while ($iprod <= $nprod)
22 phil 1.1 set prod = $product[$iprod]
23 if ($prod == lev0) then
24 set times = `show_info key=T_OBS -q hmi.lev0a'[? FSN < 200000000 ?]' n=-1`
25 else
26 set times = `show_info -q key=T_OBS hmi.$prod'[$]'`
27 endif
28 set times_t = `time_convert time=$times`
29 @ lags = ( $now_t - $times_t ) / 60
30 if ($lags <= $green[$iprod]) then
31 set stat = GREEN
32 else if ($lags <= $yellow[$iprod]) then
33 set stat = YELLOW
34 else
35 set stat = RED
36 endif
37 if ($lags < 60) then
38 set lag = $lags" minutes"
39 else if ($lags < 1440) then
40 set hours = `arith $lags / 60`
41 set lag = $hours" hours"
42 else
43 phil 1.1 set days = `arith $lags / 1440`
44 set lag = $days" days"
45 endif
46 echo "`printf %-12s $prod`" "`printf %7s $stat`" ' ' $lag
47 @ iprod = $iprod + 1
48 end
49
50
|