File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,15 +38,20 @@ pushd "$EXEC_DIR" || exit 1
3838
3939while true ; do
4040 {
41- START=$( date +%s)
42- echo " $( date ' +%F %T' ) : update started" >> " $DB_DIR /rules_loop.log"
43- ./osm3s_query --progress --rules < " $DB_DIR /rules/areas.osm3s"
44- echo " $( date ' +%F %T' ) : update finished" >> " $DB_DIR /rules_loop.log"
45- WORK_TIME=$(( $(date +% s) - START))
46- SLEEP_TIME=$(( WORK_TIME * 100 / CPU_LOAD - WORK_TIME))
47- # let SLEEP_TIME be at least 3 seconds
48- SLEEP_TIME=$(( SLEEP_TIME < 3 ? 3 : SLEEP_TIME))
49- echo " It took $WORK_TIME to run the loop. Desired load is: ${CPU_LOAD} %. Sleeping: $SLEEP_TIME "
50- sleep " $SLEEP_TIME "
41+ if [[ -z " ${OVERPASS_DIFF_URL} " ]]; then
42+ echo " OVERPASS_DIFF_URL is not set - updates disabled, assuming areas created on init, sleeping forever"
43+ sleep infinity
44+ else
45+ START=$( date +%s)
46+ echo " $( date ' +%F %T' ) : update started" >> " $DB_DIR /rules_loop.log"
47+ ./osm3s_query --progress --rules < " $DB_DIR /rules/areas.osm3s"
48+ echo " $( date ' +%F %T' ) : update finished" >> " $DB_DIR /rules_loop.log"
49+ WORK_TIME=$(( $(date +% s) - START))
50+ SLEEP_TIME=$(( WORK_TIME * 100 / CPU_LOAD - WORK_TIME))
51+ # let SLEEP_TIME be at least 3 seconds
52+ SLEEP_TIME=$(( SLEEP_TIME < 3 ? 3 : SLEEP_TIME))
53+ echo " It took $WORK_TIME to run the loop. Desired load is: ${CPU_LOAD} %. Sleeping: $SLEEP_TIME "
54+ sleep " $SLEEP_TIME "
55+ fi
5156 }
5257done
You can’t perform that action at this time.
0 commit comments