Skip to content

Commit 4583639

Browse files
committed
Kill sshd on SIGTERM instead of waiting for docker stop timeout.
1 parent 72f69a5 commit 4583639

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

start.sh

100644100755
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/bin/sh
22

3+
_term() {
4+
echo "Caught SIGTERM signal!"
5+
kill -TERM "$child" 2>/dev/null
6+
}
7+
8+
trap _term SIGTERM
9+
310
# If there is some public key in keys folder
411
# then it copies its contain in authorized_keys file
512
if [ "$(ls -A /git-server/keys/)" ]; then
@@ -19,5 +26,7 @@ if [ "$(ls -A /git-server/repos/)" ]; then
1926
find . -type d -exec chmod g+s '{}' +
2027
fi
2128

22-
# -D flag avoids executing sshd as a daemon
23-
/usr/sbin/sshd -D
29+
/usr/sbin/sshd
30+
31+
child=$!
32+
wait "$child"

0 commit comments

Comments
 (0)