File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33DIFF_DIR=" /mnt/data/diff"
44STATE_FILE=" $DIFF_DIR /last.state.txt"
55MAX_STALE_SECONDS=" ${MAX_STALE_SECONDS:- 3600} " # 1 hour
6+ READY_FILE=" /tmp/imposm_ready"
7+ STARTUP_GRACE_SECONDS=" ${STARTUP_GRACE_SECONDS:- 300} " # 5 minutes
8+
9+ # Skip checks if imposm hasn't started yet (still in startup/config phase)
10+ if [ ! -f " $READY_FILE " ]; then
11+ # Check how long the container has been running
12+ UPTIME_SECONDS=$( awk ' {print int($1)}' /proc/uptime)
13+ if [ " $UPTIME_SECONDS " -lt " $STARTUP_GRACE_SECONDS " ]; then
14+ echo " Imposm still starting up (${UPTIME_SECONDS} s < ${STARTUP_GRACE_SECONDS} s grace). Skipping checks."
15+ exit 0
16+ else
17+ echo " Startup grace period exceeded and imposm never became ready. Exiting..."
18+ pkill -f start.sh && exit 1
19+ fi
20+ fi
621
722# 1) Check if imposm is running
823if ! pgrep -f imposm > /dev/null; then
Original file line number Diff line number Diff line change @@ -27,8 +27,9 @@ if [ -s /tmp/imposm.log ]; then
2727 # Keep only the last 20 log files to avoid filling the volume
2828 ls -t " $IMPOSM_LOG_DIR " /imposm_* .log 2> /dev/null | tail -n +21 | xargs rm -f 2> /dev/null
2929fi
30- # Clear log to prevent liveness probe from detecting stale errors on restart
30+ # Clear log and ready flag to prevent liveness probe from detecting stale errors on restart
3131> /tmp/imposm.log
32+ rm -f /tmp/imposm_ready
3233
3334# Tracking file for uploaded files
3435TRACKING_FILE=" $WORKDIR /uploaded_files.log"
286287 -quiet 2>&1 | tee /tmp/imposm.log &
287288 IMPOSM_PID=$!
288289
290+ # Signal liveness probe that imposm is running
291+ touch /tmp/imposm_ready
292+
289293 # Step 5: Monitor imposm process and handle errors
290294 monitorImposmErrors $IMPOSM_PID $UPLOADER_PID
291295}
You can’t perform that action at this time.
0 commit comments