Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile.ubuntu-2004
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ENV UPDATE_CHECK=60
ENV USER=linuxgsm
ENV UID=1000
ENV GID=1000
ENV LGSM_SAVE_CRONTAB=false

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

Expand Down
1 change: 1 addition & 0 deletions Dockerfile.ubuntu-2204
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ENV UPDATE_CHECK=60
ENV USER=linuxgsm
ENV UID=1000
ENV GID=1000
ENV LGSM_SAVE_CRONTAB=false

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

Expand Down
1 change: 1 addition & 0 deletions Dockerfile.ubuntu-2404
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ENV UPDATE_CHECK=60
ENV USER=linuxgsm
ENV UID=1000
ENV GID=1000
ENV LGSM_SAVE_CRONTAB=false

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

Expand Down
7 changes: 6 additions & 1 deletion entrypoint-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ else
./"${GAMESERVER}" sponsor
fi

if [ -n "${UPDATE_CHECK}" ] && [ "${UPDATE_CHECK}" != "0" ]; then
if ( "${LGSM_SAVE_CRONTAB}" ) && [ -e "${LGSM_CRONTAB_SAVEPOINT}" ] ; then
echo -e ""
echo -e "Found saved crontab, restoring"
echo -e "================================="
cat "${LGSM_CRONTAB_SAVEPOINT}" | crontab - || echo -e "Crontab is invalid, NOT restored!"
elif [ -n "${UPDATE_CHECK}" ] && [ "${UPDATE_CHECK}" != "0" ]; then
echo -e ""
echo -e "Starting Update Checks"
echo -e "================================="
Expand Down
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

exit_handler() {
# Execute the shutdown commands
if ( ${LGSM_SAVE_CRONTAB} ) ; then
echo -e "Saving user ${USER} crontab"
crontab -u "${USER}" -l > "${LGSM_CRONTAB_SAVEPOINT}"
fi
echo -e "Stopping ${GAMESERVER}"
exec gosu "${USER}" ./"${GAMESERVER}" stop
exitcode=$?
Expand Down Expand Up @@ -62,6 +66,7 @@ chown -R "${USER}":"${USER}" /data
echo -e "updating permissions for /app"
chown -R "${USER}":"${USER}" /app
export HOME=/data
export LGSM_CRONTAB_SAVEPOINT="${HOME}"/saved-crontab

echo -e ""
echo -e "Switch to user ${USER}"
Expand Down