jammsen / docker-palworld-dedicated-server

Docker container to easily provision and manage Palworld Dedicated Server
https://hub.docker.com/r/jammsen/palworld-dedicated-server
MIT License
898 stars 151 forks source link

[Feature Request] Add delay to cron backup #209

Closed jammsen closed 4 months ago

jammsen commented 4 months ago

Have you read the Important information text above

Describe the feature

palworld-dedicated-server | >>> Backup 'saved-20240217_210000.tar.gz' created successfully palworld-dedicated-server | time="2024-02-17T21:00:07+01:00" level=info msg="job succeeded" iteration=2 job.command="backup create" job.position=0 job.schedule="0 " palworld-dedicated-server | time="2024-02-17T22:00:00+01:00" level=info msg=starting iteration=3 job.command="backup create" job.position=0 job.schedule="0 " palworld-dedicated-server | > RCON: Broadcasted: 22-00-00-Saving-in-5-seconds palworld-dedicated-server | > RCON: Broadcasted: Saving-world... palworld-dedicated-server | > RCON: Complete Save palworld-dedicated-server | > RCON: Broadcasted: Saving-done palworld-dedicated-server | > RCON: Broadcasted: Creating-backup palworld-dedicated-server | > RCON: Broadcasted: Backup-done palworld-dedicated-server | >>> Backup 'saved-20240217_220000.tar.gz' created successfully palworld-dedicated-server | time="2024-02-17T22:00:07+01:00" level=info msg="job succeeded" iteration=3 job.command="backup create" job.position=0 job.schedule="0 " palworld-dedicated-server | time="2024-02-17T23:00:00+01:00" level=info msg=starting iteration=4 job.command="backup create" job.position=0 job.schedule="0 " palworld-dedicated-server | > RCON: Broadcasted: 23-00-00-Saving-in-5-seconds palworld-dedicated-server | > RCON: Broadcasted: Saving-world... palworld-dedicated-server | > RCON: Complete Save palworld-dedicated-server | > RCON: Broadcasted: Saving-done palworld-dedicated-server | > RCON: Broadcasted: Creating-backup palworld-dedicated-server | tar: Saved/SaveGames/0/7D2B734A1D3F4771BF60FDCD7DCF8A0E/Level.sav: File shrank by 710189 bytes; padding with zeros palworld-dedicated-server | > RCON: Broadcasted: Backup-failed palworld-dedicated-server | >>> Backup failed palworld-dedicated-server | time="2024-02-17T23:00:06+01:00" level=info msg="job succeeded" iteration=4 job.command="backup create" job.position=0 job.schedule="0 "

Add 15 seconds delay to cron backup function to make sure the server is acutally done saving, even when RCON instantly says its done.

Additional information

Final checks

jammsen commented 4 months ago

Added in https://github.com/jammsen/docker-palworld-dedicated-server/commit/075952e954c0467f5fba5912c10df9d54071fa4f

judos commented 4 months ago

Still seems to cause problems even with the 15s delay:

time="2024-03-04T23:00:00+01:00" level=info msg=starting iteration=19 job.command="backup create" job.position=0 job.schedule="0 * * * *"
> RCON: Broadcasted: 23-00-00-Saving-in-5-seconds
> RCON: Broadcasted: Saving-world...
> RCON: Complete Save
> RCON: Broadcasted: Saving-done
> RCON: Broadcasted: Creating-backup
tar: Saved/SaveGames/0/DC67E50A48EC478A921A005201663019/Level.sav: File shrank by 3084857 bytes; padding with zeros
> RCON: Broadcasted: Backup-failed
>>> Backup failed
time="2024-03-04T23:00:20+01:00" level=info msg="job succeeded" iteration=19 job.command="backup create" job.position=0 job.schedule="0 * * * *"

I manually increased it to 30s for my server, maybe that helps. Is there maybe another way to actually know when palworld is done saving to the file?

jammsen commented 4 months ago

Hey @judos

Still seems to cause problems even with the 15s delay:

yeah rarely it doesnt do it for me too, like 1 out of a 100 times.

Is there maybe another way to actually know when palworld is done saving to the file?

There is no actual way to certainly "know" this, one could maybe watch with inotifywait on a savegame file, but as we dont know the code and how saves are handled, there is no way to know for sure if that would help, just blind guesses. Could make it even worse than now.

I manually increased it to 30s for my server, maybe that helps.

Even if i would enable this to set this as an ENV-Var and you could set it to 45 seconds, it still could happen, because of process-allocations and such.