@@ -18,7 +18,7 @@ mkdir -p $imposm3_expire_dir
18
18
settingDir=/osm
19
19
# Folder to store the imposm expider files in s3 or gs
20
20
BUCKET_IMPOSM_FOLDER=imposm
21
-
21
+ INIT_FILE=/mnt/data/init_done
22
22
# Create config file to set variable for imposm
23
23
echo " {" > $workDir /config.json
24
24
echo " \" cachedir\" : \" $cachedir \" ," >> $workDir /config.json
@@ -148,23 +148,20 @@ function importData () {
148
148
# These index will help speed up tegola tile generation
149
149
psql " postgresql://$POSTGRES_USER :$POSTGRES_PASSWORD @$POSTGRES_HOST /$POSTGRES_DB " -a -f config/postgis_index.sql
150
150
151
- touch /mnt/data/init_done
151
+ touch $INIT_FILE
152
152
# Update the DB
153
153
updateData
154
154
}
155
155
156
156
157
- echo " Connecting to DB... "
157
+ echo " Connecting to $POSTGRES_HOST DB "
158
158
flag=true
159
159
while " $flag " = true ; do
160
160
pg_isready -h $POSTGRES_HOST -p 5432 > /dev/null 2>&2 || continue
161
161
# Change flag to false to stop ping the DB
162
162
flag=false
163
- hasData=$( psql " postgresql://$POSTGRES_USER :$POSTGRES_PASSWORD @$POSTGRES_HOST /$POSTGRES_DB " \
164
- -c " SELECT count(*) FROM information_schema.tables WHERE table_schema = 'public'" | sed -n 3p | sed ' s/ //g' )
165
- # After import there are more than 70 tables
166
- echo " $hasData tables in the DB"
167
- if ([ $hasData \> 70 ] && [[ -f /mnt/data/init_done ]]); then
163
+ echo " Check if $INIT_FILE exists"
164
+ if ([[ -f $INIT_FILE ]]); then
168
165
echo " Update the DB with osm data"
169
166
updateData
170
167
else
0 commit comments