This commit is contained in:
Carlos M. Martinez
2024-01-28 17:25:52 -05:00
parent f6a3b982b2
commit 5586e7044a
3 changed files with 10 additions and 11 deletions

View File

@@ -12,8 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN wget -q https://github.com/gorcon/rcon-cli/releases/download/v0.10.3/rcon-0.10.3-amd64_linux.tar.gz -O - | tar -xz && \
mv rcon-0.10.3-amd64_linux/rcon /usr/bin/rcon-cli && \
rmdir /tmp/dumps && \
rm -f /var/run/crond.pid
rmdir /tmp/dumps
ENV PORT= \
PUID=1000 \

View File

@@ -22,6 +22,10 @@ term_handler() {
tail --pid=$killpid -f 2>/dev/null
}
if [ "${BACKUP_ENABLED}" = true ]; then
service cron start
fi
trap 'term_handler' SIGTERM
su steam -c ./start.sh &

View File

@@ -289,16 +289,12 @@ if [ -n "${RCON_PORT}" ]; then
sed -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini
fi
if [ -n $BACKUP_ENABLED ]; then
if [ "${BACKUP_ENABLED}" = true ]; then
echo "BACKUP_ENABLED=${BACKUP_ENABLED}"
if [ $BACKUP_ENABLED = true ]; then
CRON_EXPRESSION=$([[ -n $BACKUP_CRON_EXPRESSION ]] && echo "$BACKUP_CRON_EXPRESSION" || echo "0 0 * * *")
echo "CRON_EXPRESSION=${CRON_EXPRESSION}"
echo "${CRON_EXPRESSION} root bash /usr/loca/bin/backup" > /etc/cron.d/backups-cron
chmod 0644 /etc/cron.d/backups-cron
cron /etc/cron.d/backups-cron
fi
# Assuming BACKUP_CRON_EXPRESSION is set and is valid
echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup >/dev/null 2>&1" > "/home/steam/server/crontab"
crontab "/home/steam/server/crontab"
fi
# Configure RCON settings