Skip to content

Commit cfde474

Browse files
authored
Merge pull request #90 from fireblade004/main
Fix graceful shutdown on proton
2 parents 5e77cd9 + 41f5aa2 commit cfde474

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

container/proton/entrypoint.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,15 @@ while [ $timeout -lt 11 ]; do
126126
echo "$(timestamp) INFO: Waiting for enshrouded_server.exe to be running"
127127
done
128128

129-
# Hold us open until we recieve a SIGTERM
129+
# Hold us open until we recieve a SIGTERM by opening a job waiting for the process to finish then calling `wait`
130+
tail --pid=$enshrouded_pid -f /dev/null &
130131
wait
131132

132-
# Handle post SIGTERM from here
133-
# Hold us open until WSServer-Linux pid closes, indicating full shutdown, then go home
134-
tail --pid=$enshrouded_pid -f /dev/null
133+
# Handle post SIGTERM from here (SIGTERM will cancel the `wait` immediately even though the job is not done yet)
134+
# Check if the enshrouded_server.exe process is still running, and if so, wait for it to close, indicating full shutdown, then go home
135+
if ps -e | grep "enshrouded_serv"; then
136+
tail --pid=$enshrouded_pid -f /dev/null
137+
fi
135138

136139
# o7
137140
echo "$(timestamp) INFO: Shutdown complete."

0 commit comments

Comments
 (0)