Skip to content

Commit 5d6c7cb

Browse files
committed
Keep imposm logs from each restart
1 parent a0802f2 commit 5d6c7cb

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

images/tiler-imposm/start.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ INIT_FILE="$WORKDIR/init_done"
1919

2020
mkdir -p "$CACHE_DIR" "$DIFF_DIR" "$IMPOSM3_EXPIRE_DIR"
2121

22+
# Archive old imposm log before clearing, so we can debug what caused the restart
23+
IMPOSM_LOG_DIR="$WORKDIR/imposm_logs"
24+
mkdir -p "$IMPOSM_LOG_DIR"
25+
if [ -s /tmp/imposm.log ]; then
26+
cp /tmp/imposm.log "$IMPOSM_LOG_DIR/imposm_$(date +%Y%m%d_%H%M%S).log"
27+
# Keep only the last 20 log files to avoid filling the volume
28+
ls -t "$IMPOSM_LOG_DIR"/imposm_*.log 2>/dev/null | tail -n +21 | xargs rm -f 2>/dev/null
29+
fi
30+
# Clear log to prevent liveness probe from detecting stale errors on restart
31+
> /tmp/imposm.log
32+
2233
# Tracking file for uploaded files
2334
TRACKING_FILE="$WORKDIR/uploaded_files.log"
2435
[ -f "$TRACKING_FILE" ] || touch "$TRACKING_FILE"

0 commit comments

Comments
 (0)