diff --git a/Dockerfile b/Dockerfile index 983e9ee..d7c657b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,6 +40,8 @@ ENV AUTOSAVENUM="5" \ TIMEOUT="30" \ VMOVERRIDE="false" +STOPSIGNAL SIGINT + EXPOSE 7777/udp 7777/tcp ENTRYPOINT [ "/init.sh" ] diff --git a/run.sh b/run.sh index 5f05c9b..f69f739 100755 --- a/run.sh +++ b/run.sh @@ -104,4 +104,15 @@ fi cd /config/gamefiles || exit 1 -exec ./FactoryServer.sh -Port="$SERVERGAMEPORT" "${ini_args[@]}" "$@" +./FactoryServer.sh -Port="$SERVERGAMEPORT" "${ini_args[@]}" "$@" & + +sleep 2 +satisfactory_pid=$(ps --ppid ${!} o pid=) + +shutdown() { + printf "\\nReceived SIGINT. Shutting down.\\n" + kill -INT $satisfactory_pid 2>/dev/null +} +trap shutdown SIGINT SIGTERM + +wait