From 21bc02f3ce9881906bf6a929c0a42d89a5259387 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 13 Jan 2023 23:45:52 +0000 Subject: [PATCH] fix healthcheck --- Dockerfile.ubuntu-1804 | 2 +- Dockerfile.ubuntu-2004 | 2 +- Dockerfile.ubuntu-2204 | 3 ++- entrypoint-healthcheck.sh | 3 +++ entrypoint-user.sh | 14 +++++++------- entrypoint.sh | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) create mode 100755 entrypoint-healthcheck.sh diff --git a/Dockerfile.ubuntu-1804 b/Dockerfile.ubuntu-1804 index 1bf3d7c..c347824 100644 --- a/Dockerfile.ubuntu-1804 +++ b/Dockerfile.ubuntu-1804 @@ -106,7 +106,7 @@ RUN echo "**** Add linuxgsm user ****" \ && chmod 0440 /etc/sudoers.d/$USERNAME \ && chown $USERNAME:$USERNAME /home/$USERNAME -HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/*server monitor || exit 1 +HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/entrypoint-healthcheck.sh || exit 1 ## Download linuxgsm.sh RUN echo "**** Download linuxgsm.sh ****" \ diff --git a/Dockerfile.ubuntu-2004 b/Dockerfile.ubuntu-2004 index faa139a..3dde0da 100644 --- a/Dockerfile.ubuntu-2004 +++ b/Dockerfile.ubuntu-2004 @@ -106,7 +106,7 @@ RUN echo "**** Add linuxgsm user ****" \ && chmod 0440 /etc/sudoers.d/$USERNAME \ && chown $USERNAME:$USERNAME /home/$USERNAME -HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/*server monitor || exit 1 +HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/entrypoint-healthcheck.sh || exit 1 ## Download linuxgsm.sh RUN echo "**** Download linuxgsm.sh ****" \ diff --git a/Dockerfile.ubuntu-2204 b/Dockerfile.ubuntu-2204 index 83b40ad..4dc168b 100644 --- a/Dockerfile.ubuntu-2204 +++ b/Dockerfile.ubuntu-2204 @@ -104,7 +104,7 @@ RUN echo "**** Add linuxgsm user ****" \ && chmod 0440 /etc/sudoers.d/$USERNAME \ && chown $USERNAME:$USERNAME /home/$USERNAME -HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/*server monitor || exit 1 +HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/entrypoint-healthcheck.sh || exit 1 ## Download linuxgsm.sh RUN echo "**** Download linuxgsm.sh ****" \ @@ -127,6 +127,7 @@ RUN echo "**** Get LinuxGSM Modules ****" \ COPY entrypoint.sh /linuxgsm/entrypoint.sh COPY entrypoint-user.sh /linuxgsm/entrypoint-user.sh +COPY entrypoint-healthcheck.sh /linuxgsm/entrypoint-healthcheck.sh RUN date > /build-time.txt diff --git a/entrypoint-healthcheck.sh b/entrypoint-healthcheck.sh new file mode 100755 index 0000000..2395897 --- /dev/null +++ b/entrypoint-healthcheck.sh @@ -0,0 +1,3 @@ +#!/bin/bash +echo HEALTHCHECK +exec s6-setuidgid ${USERNAME} /linuxgsm/*server monitor diff --git a/entrypoint-user.sh b/entrypoint-user.sh index 97a80ea..9473ad2 100755 --- a/entrypoint-user.sh +++ b/entrypoint-user.sh @@ -5,7 +5,7 @@ if [ ! -f "${GAMESERVER}" ]; then echo -e "" echo -e "creating ${GAMESERVER}" echo -e "=================================" - exec s6-setuidgid ${USERNAME} ./linuxgsm.sh ${GAMESERVER} + ./linuxgsm.sh ${GAMESERVER} fi # Clear functions directory if not master @@ -22,16 +22,16 @@ if [ -z "$(ls -A -- "serverfiles" >/dev/null 2>&1)" ]; then echo -e "" echo -e "Installing ${GAMESERVER}" echo -e "=================================" - exec s6-setuidgid ${USERNAME} ./${GAMESERVER} auto-install + ./${GAMESERVER} auto-install install=1 else # Donate to display logo - exec s6-setuidgid ${USERNAME} ./${GAMESERVER} donate + exec ./${GAMESERVER} donate fi echo -e "" echo -e "Starting Update Checks" echo -e "=================================" -nohup watch -n "${UPDATE_CHECK}" exec s6-setuidgid ${USERNAME} ./${GAMESERVER} update >/dev/null 2>&1 & +nohup watch -n "${UPDATE_CHECK}" exec ./${GAMESERVER} update >/dev/null 2>&1 & echo -e "update will check every ${UPDATE_CHECK} minutes" # Update game server @@ -39,15 +39,15 @@ if [ -z "${install}" ]; then echo -e "" echo -e "Checking for Update ${GAMESERVER}" echo -e "=================================" - exec s6-setuidgid ${USERNAME} ./${GAMESERVER} update + ./${GAMESERVER} update fi echo -e "" echo -e "Starting ${GAMESERVER}" echo -e "=================================" -exec s6-setuidgid ${USERNAME} ./${GAMESERVER} start +./${GAMESERVER} start sleep 5 -exec s6-setuidgid ${USERNAME} ./${GAMESERVER} details +./${GAMESERVER} details sleep 2 echo -e "Tail log files" echo -e "=================================" diff --git a/entrypoint.sh b/entrypoint.sh index 6ffb306..e7cbe64 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,7 @@ exit_handler() { # Execute the shutdown commands echo -e "stopping ${GAMESERVER}" - ./${GAMESERVER} stop + exec s6-setuidgid ${USERNAME} ./${GAMESERVER} stop exitcode=$? exit ${exitcode} }