Skip to content

Commit b31053f

Browse files
committed
Trapping SIGTERM SIGINT to gracefully shutdown containers. Fixes #806
1 parent 7da456d commit b31053f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Base/entry_point.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
#!/usr/bin/env bash
22

3-
/usr/bin/supervisord --configuration /etc/supervisord.conf
3+
/usr/bin/supervisord --configuration /etc/supervisord.conf &
4+
5+
SUPERVISOR_PID=$!
6+
7+
function shutdown {
8+
echo "Trapped SIGTERM/SIGINT/x so shutting down supervisord..."
9+
kill -s SIGTERM ${SUPERVISOR_PID}
10+
wait ${SUPERVISOR_PID}
11+
echo "Shutdown complete"
12+
}
13+
14+
trap shutdown SIGTERM SIGINT
15+
wait ${SUPERVISOR_PID}

0 commit comments

Comments
 (0)