-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-feedstore.sh
55 lines (45 loc) · 989 Bytes
/
run-feedstore.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
#!/bin/sh
set -Ceuo pipefail
PATH=/bin:/usr/bin
: ${phase:?} ${base:?} ${reftime:?} ${datedir:?} ${nwp:?}
export phase base reftime datedir nwp
case "`date +%M`" in
01)
exit 0
;;
esac
: ${ruby:=/usr/bin/ruby}
: ${feeddir:='https://www.data.jma.go.jp/developer/xml/feed'}
: ${ca:='/etc/ssl/certs/'}
: ${magic:=20}
cd ${datedir}
sleep ${magic}
rc=0 && \
$ruby ${nwp}/bin/feedstore.rb jmx-lmt.db jmx-${reftime} ${ca} -a60 \
"-xVPRN50" \
"${feeddir}/regular.xml" "${feeddir}/extra.xml" \
"${feeddir}/eqvol.xml" "${feeddir}/other.xml" \
|| rc=$?
# exit 3 is HTTP 304 Not Modified, to be ignored
stderr=-s
case $rc in
0|3)
stderr=''
;;
esac
logger --tag feedstore --id=$$ -p news.err $stderr -- "rc=$rc"
if (( $rc == 0 )) ; then
for prog in ${nwp}/bin/act-jmx-*.sh
do
if test -e $prog ; then
msg=$(echo nwp=$nwp bash $prog | batch 2>&1)
logger --tag feedstore --id=$$ -p news.info -- "$msg"
fi
done
fi
case $rc in
3)
rc=3
;;
esac
exit $rc