Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cron job to backup save files #39

Closed
GMBridge opened this issue Jan 21, 2024 · 5 comments
Closed

cron job to backup save files #39

GMBridge opened this issue Jan 21, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@GMBridge
Copy link

considering how unstable the game is, automatic backups every hour or so (keeping the last X backups) would be helpful if someone needs to roll back to recover after a bug or crash.

@thijsvanloef thijsvanloef added the enhancement New feature or request label Jan 21, 2024
@mpfiv
Copy link

mpfiv commented Jan 22, 2024

also a cron job to periodically restart would be a nice addition if you are keeping backups x far back.

@thijsvanloef
Copy link
Owner

Open PR #86 to create backups with a single command

@Dashboy1998 Dashboy1998 mentioned this issue Jan 29, 2024
3 tasks
@cinderisles
Copy link

cinderisles commented Jan 29, 2024

I added a cronjob for the backup command added in #86 by adding cron to the dependencies installed in the Dockerfile

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 \
    cron\
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

then added this to scripts/init.sh

echo "*/5 * * * * root /usr/local/bin/backup > /proc/1/fd/1 2>&1" > /etc/cron.d/backup
service cron start

this runs the backup command every 5 minutes

see my fork (ignore the other file changes ._.)

@llnut
Copy link

llnut commented Jan 29, 2024

I added a cronjob for the backup command added in #86 by adding cron to the dependencies installed in the Dockerfile

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 \
    cron\
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

then added this to scripts/init.sh

echo "*/5 * * * * root /usr/local/bin/backup > /proc/1/fd/1 2>&1" > /etc/cron.d/backup
service cron start

this runs the backup command every 5 minutes

see my fork (ignore the other file changes ._.)

I don't think automatic backup requires as much attention to the timing of the trigger as an automatic restart service does. If I were you, I would choose the following docker-compose configuration to implement the backup function, as it is obviously simpler:

backuper:
  image: docker:cli
  volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
  command: ["/bin/sh", "-c", "while true; do sleep 900; docker exec palworld-server backup; done"]
  restart: unless-stopped

of course, this is just my own opinion.

@Dashboy1998
Copy link
Contributor

Solved by #194.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants