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 backup #194

Merged
merged 40 commits into from
Jan 29, 2024
Merged

Cron backup #194

merged 40 commits into from
Jan 29, 2024

Conversation

Dashboy1998
Copy link
Contributor

@Dashboy1998 Dashboy1998 commented Jan 29, 2024

Context

Choices

  • Set as default to prevent issues like World and characters disapeared after crash #183, Although I think it should be ran hourly but I will wait until optionally delete old backups #188 as to not eat up storage.
  • Using supercronic instead of cron since cron is not able to use environmental variables and it outputs to terminal
    palworld-server-test | time="2024-01-28T17:33:00-05:00" level=info msg=starting iteration=0 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"

Test instructions

  1. Set BACKUP_CRON_EXPRESSION to * * * * * to backup every minute to reduce waiting while testing
  2. Verify backups are being made every minute
  3. Verify supercronic starts as steam: docker exec -it palworld-server bash -c "top -n 1 | grep supercronic | grep --color steam"

Checklist before requesting a review

  • I have performed a self-review of my code
  • I've added documentation about this change to the README.
  • I've not introduced breaking changes.

@thijsvanloef
Copy link
Owner

Nice work! Will test tonight, after #188 is merged

Copy link
Owner

@thijsvanloef thijsvanloef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting the following error while running a cronjob to backup:

palworld-server  | *****STARTING SERVER*****
palworld-server  | ./PalServer.sh -port=8211 -servername="World of Pals" -serverdescription="" -serverpassword="worldofpals" -adminpassword="adminPasswordHere" -queryport=27015 -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS
palworld-server  | time="2024-01-29T17:04:03Z" level=info msg="read crontab: /home/steam/server/crontab"
palworld-server  | [S_API] SteamAPI_Init(): Loaded local 'steamclient.so' OK.
palworld-server  | Shutdown handler: initalize.
palworld-server  | Increasing per-process limit of core file size to infinity.
palworld-server  | CAppInfoCacheReadFromDiskThread took 2 milliseconds to initialize
palworld-server  | Setting breakpad minidump AppID = 2394010
palworld-server  | [S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded.
palworld-server  | [S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded.
palworld-server  | [S_API FAIL] Tried to access Steam interface STEAMAPPS_INTERFACE_VERSION008 before SteamAPI_Init succeeded.
palworld-server  | [S_API FAIL] Tried to access Steam interface SteamNetworkingUtils004 before SteamAPI_Init succeeded.
palworld-server  | time="2024-01-29T17:05:00Z" level=info msg=starting iteration=0 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:05:00Z" level=info msg="cli: config: parse file: read file: open rcon.yaml: no such file or directory" channel=stderr iteration=0 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:05:00Z" level=info msg="backup created at /palworld/backups/palworld-save-2024-01-29_17-05-00.tar.gz" channel=stdout iteration=0 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:05:00Z" level=info msg="job succeeded" iteration=0 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:06:00Z" level=info msg=starting iteration=1 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:06:00Z" level=info msg="cli: config: parse file: read file: open rcon.yaml: no such file or directory" channel=stderr iteration=1 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:06:00Z" level=info msg="backup created at /palworld/backups/palworld-save-2024-01-29_17-06-00.tar.gz" channel=stdout iteration=1 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:06:00Z" level=info msg="job succeeded" iteration=1 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:07:00Z" level=info msg=starting iteration=2 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:07:00Z" level=info msg="cli: config: parse file: read file: open rcon.yaml: no such file or directory" channel=stderr iteration=2 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:07:00Z" level=info msg="backup created at /palworld/backups/palworld-save-2024-01-29_17-07-00.tar.gz" channel=stdout iteration=2 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"
palworld-server  | time="2024-01-29T17:07:00Z" level=info msg="job succeeded" iteration=2 job.command="bash /usr/local/bin/backup" job.position=0 job.schedule="* * * * *"

It seems like the rcon-cli cant find the rcon.yaml

@thijsvanloef
Copy link
Owner

It seems like supercronic was not able to find the rcon.yaml in the default location, added the full path and it runs without issues

@thijsvanloef thijsvanloef merged commit 61b816c into thijsvanloef:main Jan 29, 2024
4 checks passed
MusclePr pushed a commit to MusclePr/palworld-server-docker that referenced this pull request Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants