Skip to content

Commit 06ba93a

Browse files
committed
Don't restart postgres on SIGTERM
Signed-off-by: Tamal Saha <[email protected]>
1 parent 652443a commit 06ba93a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/run.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#!/usr/bin/env bash
22

3+
STOP=false
4+
# don't restart postgres on SIGTERM (eg, pod deleted)
5+
# ref: https://opensource.com/article/20/6/bash-trap
6+
trap \
7+
"{ STOP=true; }" \
8+
SIGINT SIGTERM EXIT
9+
310
#going to change this with the check of process id
411
rm -f "$PGDATA"/postmaster.pid
512
echo "waiting for the role to be decided ..."
613
while true; do
7-
if [[ -e /run_scripts/role/run.sh ]]; then
14+
if [[ -e /run_scripts/role/run.sh ]] && [[ "$STOP" = false ]]; then
815
echo "running the initial script ..."
916
if [[ $REMOTE_REPLICA == "true" ]]; then
1017
/run_scripts/role/remote-replica.sh

0 commit comments

Comments
 (0)