-
Notifications
You must be signed in to change notification settings - Fork 0
/
cron_load_g2o_met_verf_o3pm.sh
executable file
·65 lines (61 loc) · 1.82 KB
/
cron_load_g2o_met_verf_o3pm.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
#!/bin/ba:w
sh
#
# This script is intended for the near-real-time daily addition tot he database by month
#
module load prod_util
flag_realtime=no
MSG="$0 envir [prod|...] start_date end_date"
if [ $# -lt 1 ]; then
echo ${MSG}
exit
else
envir=$1
fi
EXP=`echo ${envir} | tr a-z A-Z`
echo "Processing experiment ${envir} verification database addition"
if [ $# -lt 2 ]; then
TODAY=`date +%Y%m%d`
FIRSTDAY=${TODAY}
LASTDAY=${TODAY}
echo "echo near-realtime addition to the database"
else
FIRSTDAY=$2
LASTDAY=$2
echo "echo selected date ${FIRSTDAY} addition to the database"
fi
if [ $# -eq 3 ]; then LASTDAY=$3; fi
DY0=`echo ${FIRSTDAY} | cut -c7-8`
if [ "${DY0}" == "01" ]; then
NEW_ADD="true"
else
NEW_ADD="false"
fi
##
SCRIPT=/lfs/h2/emc/physics/noscrub/${USER}/METviewer_AWS/script
XML=/lfs/h2/emc/vpppg/save/${USER}/METviewer_AWS/XML
BASE_DIR=/lfs/h2/emc/stmp/${USER}/load_to_aws
##
YM0=`echo ${FIRSTDAY} | cut -c1-6`
verif_type=g2o_met_verf_o3pm
met_datbase=mv_${verif_type}_${envir}_${YM0}
load_datbase_template=load_${verif_type}.base
load_datbase_xml=load_${verif_type}.xml
if [ "${NEW_ADD}" == "true" ]; then
$SCRIPT/mv_create_db_on_aws.sh ho-chun.huang ${met_datbase}
echo "Create new database done!"
fi
cd ${LOAD_DIR}
NOW=${FIRSTDAY}
while [ ${NOW} -le ${LASTDAY} ]; do
YM=`echo ${NOW} | cut -c1-6`
if [ "${YM}" != "${YM0}" ]; then break; fi
DATA_DIR=/lfs/h2/emc/physics/noscrub/${USER}/metplus_aq/stat/aqm/${NOW}
cp ${DATA_DIR}/${EXP}* .
cdate=${NOW}"00"
NOW=$(${NDATE} +24 ${cdate}| cut -c1-8)
done
sed -e "s!xxdatabasexx!${met_datbase}!" -e "s!xxnewaddxx!${NEW_ADD}!" ${XML}/${load_datbase_template} > ${XML}/${load_datbase_xml}
$SCRIPT/mv_load_to_aws.sh ho-chun.huang ${BASE_DIR} ${XML}/${load_datbase_xml}
echo "run_scrpt = ${XML}/${load_datbase_xml}"
exit