feat: Add cron command for DockerFile

This commit is contained in:
Guillaume Barreau
2024-01-25 02:25:14 -05:00
parent e870520681
commit 9868ce7233
2 changed files with 21 additions and 5 deletions

View File

@@ -5,21 +5,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
xdg-user-dirs=0.17-2 \
procps=2:3.3.17-5 \
wget=1.21-1+deb11u1 \
&& apt-get install -y cron \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN wget -q https://github.com/itzg/rcon-cli/releases/download/1.6.4/rcon-cli_1.6.4_linux_amd64.tar.gz -O - | tar -xz
RUN mv rcon-cli /usr/bin/rcon-cli
RUN rm -f /var/run/crond.pid
RUN apt-get update && apt-get -y install cron
COPY ./scripts/backup.sh /usr/local/bin/backup
RUN chmod +x /usr/local/bin/backup
RUN echo "*/1 * * * * /usr/local/bin/backup\n" > /etc/cron.d/backups-cron
RUN echo "0 3 * * * root bash /usr/local/bin/backup" > /etc/cron.d/backups-cron
RUN chmod 0644 /etc/cron.d/backups-cron
RUN crontab /etc/cron.d/backups-cron
ENV PORT= \
PUID=1000 \

View File

@@ -162,6 +162,25 @@ docker exec palworld-server backup
This will create a backup at `/palworld/backups/`
## Setting Up Automatic Backups with Cron
This section guides you through the process of configuring automatic backups using Cron. Use the provided command to set up the necessary Cron job for your Palworld server within a Docker environment.
The configured backup system automatically deletes backups older than 7 days to manage storage efficiently.
```bash
docker exec palworld-server cron /etc/cron.d/backups-cron
```
Additionally, to stop the cron process within the Docker container, you can use the following command:
```bash
docker exec palworld-server service cron stop
```
This command stops the cron service within the specified container, halting the scheduled cron job.
## Editing Server Settings
When the server starts, a `PalWorldSettings.ini` file will be created in the following location: `<mount_folder>/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini`