diff --git a/entrypoint-user.sh b/entrypoint-user.sh index c9d3245..eebaaf8 100755 --- a/entrypoint-user.sh +++ b/entrypoint-user.sh @@ -1,4 +1,17 @@ #!/bin/bash + +exit_handler() { + # Execute the shutdown commands + echo -e "stopping ${GAMESERVER}" + exec gosu "${USERNAME}" ./"${GAMESERVER}" stop + exitcode=$? + exit ${exitcode} +} + +# Exit trap +echo -e "Loading exit handler" +trap exit_handler SIGQUIT SIGINT SIGTERM + # Setup game server if [ ! -f "${GAMESERVER}" ]; then echo -e "" @@ -24,6 +37,7 @@ if [ -z "$(ls -A -- "/data/serverfiles" 2> /dev/null)" ]; then ./"${GAMESERVER}" auto-install install=1 else + echo -e "" # Sponsor to display LinuxGSM logo ./"${GAMESERVER}" sponsor fi diff --git a/entrypoint.sh b/entrypoint.sh index 856ef87..3e3091f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,7 @@ exit_handler() { # Execute the shutdown commands echo -e "stopping ${GAMESERVER}" - exec gosu "${USERNAME}" ./${GAMESERVER} stop + exec gosu "${USERNAME}" ./"${GAMESERVER}" stop exitcode=$? exit ${exitcode} } @@ -11,6 +11,7 @@ exit_handler() { # Exit trap echo -e "Loading exit handler" trap exit_handler SIGQUIT SIGINT SIGTERM + DISTRO="$(grep "PRETTY_NAME" /etc/os-release | awk -F = '{gsub(/"/,"",$2);print $2}')" echo -e "" echo -e "Welcome to the LinuxGSM"