From 090c28fc626a063eee164b11f95f456ca78c080f Mon Sep 17 00:00:00 2001 From: Zakary Timson Date: Fri, 29 May 2026 22:02:01 -0400 Subject: [PATCH] Update entrypoint.sh --- entrypoint.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 5f9b87b..0092099 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,10 +7,13 @@ if [ -n "$BACKUP_CRON" ]; then cron fi -# Clean up stale locks from unclean shutdown -rm -f /data/db/mongod.lock -rm -f /data/db/.lock -rm -f /data/db/WiredTiger.lock -mongod --replSet rs0 --repair +# Clean locks & repair only if lock files exist (unclean shutdown) +if [ -f /data/db/mongod.lock ] || [ -f /data/db/WiredTiger.lock ] || [ -f /data/db/.lock ]; then + echo "Stale locks detected, running repair..." + rm -f /data/db/mongod.lock /data/db/.lock /data/db/WiredTiger.lock + mongod --replSet rs0 --repair + echo "Repair complete, starting normally..." +fi -exec /usr/local/bin/docker-entrypoint.sh "$@" +# Hand off to normal mongo entrypoint +exec /usr/local/bin/docker-entrypoint.sh "$@" \ No newline at end of file