-
Notifications
You must be signed in to change notification settings - Fork 176
/
Copy pathexgfs_pmgr.sh
executable file
·76 lines (65 loc) · 1.29 KB
/
exgfs_pmgr.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#! /usr/bin/env bash
#
# Script name: exgfs_pmgr.sh.sms
#
# This script monitors the progress of the gfs_fcst job
#
source "$HOMEgfs/ush/preamble.sh"
hour=00
TEND=384
TCP=385
if [ -e posthours ]; then
rm -f posthours
fi
while [ $hour -lt $TCP ];
do
hour=$(printf "%02d" $hour)
echo $hour >>posthours
if [ 10#$hour -lt 240 ]
then
# JY if [ $hour -lt 12 ]
if [ 10#$hour -lt 120 ]
then
let "hour=hour+1"
else
let "hour=hour+3"
fi
else
let "hour=hour+12"
fi
done
postjobs=$(cat posthours)
#
# Wait for all fcst hours to finish
#
icnt=1
while [ $icnt -lt 1000 ]
do
for fhr in $postjobs
do
fhr3=$(printf "%03d" $fhr)
if [ -s ${COMIN}/gfs.${cycle}.logf${fhr}.txt -o -s ${COMIN}/gfs.${cycle}.logf${fhr3}.txt ]
then
if [ $fhr -eq 0 ]
then
ecflow_client --event release_postanl
fi
ecflow_client --event release_post${fhr}
# Remove current fhr from list
postjobs=$(echo $postjobs | sed "s/${fhr}//")
fi
done
result_check=$(echo $postjobs | wc -w)
if [ $result_check -eq 0 ]
then
break
fi
sleep 10
icnt=$((icnt + 1))
if [ $icnt -ge 720 ]
then
msg="ABORTING after 2 hours of waiting for GFS FCST hours $postjobs."
err_exit $msg
fi
done
exit