Skip to content

Commit b62c2e5

Browse files
authored
chore: tweak autoshutdown script (#859)
1 parent 4f5d255 commit b62c2e5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docker/all-in-one/shutdown.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ SQL
6565
fi
6666
}
6767

68+
# Wait for Postgres to be up
69+
until pg_isready -h localhost > /dev/null 2>&1;
70+
do sleep 3
71+
done
72+
6873
# Enable logging of disconnections so the script can check when the last disconnection happened
6974
run_sql -c "ALTER SYSTEM SET log_disconnections = 'on';"
7075
run_sql -c "SELECT pg_reload_conf();"
@@ -83,6 +88,9 @@ while true; do
8388
MAX_IDLE_TIME_MINUTES="$DEFAULT_MAX_IDLE_TIME_MINUTES"
8489
fi
8590

86-
check_activity
91+
if [ "$MAX_IDLE_TIME_MINUTES" -gt 0 ] && [ "$MAX_IDLE_TIME_MINUTES" -lt 50000000 ]; then
92+
check_activity
93+
fi
94+
8795
sleep 30
8896
done

0 commit comments

Comments
 (0)