-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathentrypoint.sh
More file actions
47 lines (40 loc) · 1.41 KB
/
Copy pathentrypoint.sh
File metadata and controls
47 lines (40 loc) · 1.41 KB
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
#!/bin/bash
logfile="/data/init.log"
echo "Checking jageocoder dictionary..." > ${logfile}
# Search the most recent dictionary file
dicfile=$(ls -t /data/*.zip | head -n1)
# Check if jageocoder dictionary is installed
do_install=false
triefile="/opt/db2/address.trie"
if [ ! -e "${triefile}" ]; then
echo " No dictionary is installed." >> ${logfile}
do_install=true
elif [ ! -z "${dicfile}" ] && [ "${dicfile}" -nt "${triefile}" ]; then
echo " The dictionary file is newer than the installed dictionary." >> ${logfile}
do_install=true
fi
if ${do_install} = true; then
if [ -z "${dicfile}" ]; then
echo "[NG] Please place the jageocoder dictionary file in the data directory." >> ${logfile}
exit 1
fi
echo " Installing dictionary from '${dicfile}'..." >> ${logfile}
jageocoder install-dictionary -y ${dicfile} >> ${logfile} 2>&1
if [ $? -ne 0 ]; then
echo "[NG] Dictionary installation failed." >> ${logfile}
exit 1
fi
if [ ${BUILD_RTREE} -ne 0 ] ; then
echo " Building R-tree for reverse geocoding..." >> ${logfile}
jageocoder reverse 140.0 35.0 >> ${logfile} 2>&1
if [ $? -ne 0 ]; then
echo "[NG] R-tree build failed." >> ${logfile}
exit 1
fi
fi
echo "[OK] The dictionary is installed successfully." >> ${logfile}
else
echo "[OK] The dictionary is already installed." >> ${logfile}
fi
echo "Starting server process..." >> ${logfile}
python run_waitress.py