refactor: 🔥 Update main branch

This commit is contained in:
Guillaume Barreau
2024-01-26 23:57:07 -05:00
parent 00468ace96
commit 2a13366498
5 changed files with 21 additions and 21 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -32,9 +32,9 @@ ENV PORT= \
RCON_PORT=25575 \ RCON_PORT=25575 \
QUERY_PORT=27015 \ QUERY_PORT=27015 \
TZ=UTC \ TZ=UTC \
BACKUP_ENABLED=true \ BACKUP_ENABLED=false \
DAYS_TO_KEEP=7 \ DAYS_TO_KEEP= \
BACKUP_CRON_EXPRESSION="0 0 * * *" BACKUP_CRON_EXPRESSION=
COPY ./scripts/* /home/steam/server/ COPY ./scripts/* /home/steam/server/
RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/backup.sh RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/backup.sh

View File

@@ -1,6 +1,7 @@
services: services:
palworld: palworld:
image: thijsvanloef/palworld-server-docker:latest image: test/palworld-server-docker:latest
build: .
restart: unless-stopped restart: unless-stopped
container_name: palworld-server container_name: palworld-server
ports: ports:
@@ -17,9 +18,9 @@ services:
- TZ=UTC - TZ=UTC
- ADMIN_PASSWORD="adminPasswordHere" - ADMIN_PASSWORD="adminPasswordHere"
- COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD! - COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD!
- BACKUP_ENABLED=false - BACKUP_ENABLED=true
- DAYS_TO_KEEP=7 - DAYS_TO_KEEP=
- BACKUP_CRON_EXPRESSION=0 0 * * * - BACKUP_CRON_EXPRESSION=
# Enable the environment variables below if you have COMMUNITY=true # Enable the environment variables below if you have COMMUNITY=true
# - SERVER_PASSWORD="worldofpals" # - SERVER_PASSWORD="worldofpals"
# - SERVER_NAME="World of Pals" # - SERVER_NAME="World of Pals"

View File

@@ -5,7 +5,7 @@ DESTINATION_PATH="/palworld/backups"
FILE_PATH="${DESTINATION_PATH}/backup_palworld_${DATE}.tar.gz" FILE_PATH="${DESTINATION_PATH}/backup_palworld_${DATE}.tar.gz"
if [ ! -f ${FILE_PATH} ]; then if [ ! -f ${FILE_PATH} ]; then
echo "\e[0;32m***** CREATING BACKUPS FOLDER *****\e[0m\n" printf "\e[0;32m***** CREATING BACKUPS FOLDER *****\e[0m\n"
mkdir -p "${DESTINATION_PATH}" mkdir -p "${DESTINATION_PATH}"
fi fi
@@ -16,9 +16,11 @@ echo "backup created at $FILE_PATH"
if [[ -n "${DAYS_TO_KEEP}" && "${DAYS_TO_KEEP}" =~ ^[0-9]+$ ]]; then if [[ -n "${DAYS_TO_KEEP}" && "${DAYS_TO_KEEP}" =~ ^[0-9]+$ ]]; then
echo "DAYS_TO_KEEP=${DAYS_TO_KEEP}" echo "DAYS_TO_KEEP=${DAYS_TO_KEEP}"
find "${DESTINATION_PATH}" -type f -mtime +"${DAYS_TO_KEEP}" -exec rm {} \; if [[ "${DAYS_TO_KEEP}" -gt 0 ]]; then
else find "${DESTINATION_PATH}" -type f -mtime +"${DAYS_TO_KEEP}" -exec rm {} \;
echo "DAYS_TO_KEEP is not a valid number." else
echo "DAYS_TO_KEEP is zero. No files will be removed."
fi
fi fi

View File

@@ -67,19 +67,16 @@ if [ -n "${RCON_PORT}" ]; then
sed -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini sed -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini
fi fi
if [[ -n "${BACKUP_ENABLED}" ]]; then if [[ -n $BACKUP_ENABLED ]]; then
echo "BACKUP_ENABLED=${BACKUP_ENABLED}" echo "BACKUP_ENABLED=${BACKUP_ENABLED}"
if [[ -z "${BACKUP_CRON_EXPRESSION}" ]]; then if [[ $BACKUP_ENABLED == true ]]; then
printf "\e[0;31m***** BACKUP_CRON_EXPRESSION NOT SET *****\e[0m\n" CRON_EXPRESSION=$([[ -n $BACKUP_CRON_EXPRESSION ]] && echo "$BACKUP_CRON_EXPRESSION" || echo "0 0 * * *")
exit 1 echo "CRON_EXPRESSION=${CRON_EXPRESSION}"
else echo "${CRON_EXPRESSION} root bash /usr/loca/bin/backup" > /etc/cron.d/backups-cron
echo "BACKUP_CRON_EXPRESSION=${BACKUP_CRON_EXPRESSION}" chmod 0644 /etc/cron.d/backups-cron
cron /etc/cron.d/backups-cron
fi fi
echo "${BACKUP_CRON_EXPRESSION} root bash /usr/local/bin/backup" > /etc/cron.d/backups-cron
chmod 0644 /etc/cron.d/backups-cron
cron /etc/cron.d/backups-cron
fi fi
# Configure RCON settings # Configure RCON settings