From 17902d55206b01a9eab3f5aef4bc962405b3648d Mon Sep 17 00:00:00 2001 From: piravit chenpittaya Date: Wed, 24 Jan 2024 18:10:24 +0700 Subject: [PATCH 1/4] add dump save script --- Dockerfile | 4 +++- scripts/dump_save.sh | 8 ++++++++ scripts/init.sh | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 scripts/dump_save.sh diff --git a/Dockerfile b/Dockerfile index 577766d25..ce405ac33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,9 @@ ENV PORT= \ QUERY_PORT=27015 COPY ./scripts/* /home/steam/server/ -RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh +RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/dump_save.sh + +RUN mv /home/steam/server/dump_save.sh /usr/local/bin/dump_save WORKDIR /home/steam/server diff --git a/scripts/dump_save.sh b/scripts/dump_save.sh new file mode 100644 index 000000000..f94f14232 --- /dev/null +++ b/scripts/dump_save.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +DATE=$(date +"%d-%m-%Y") +FILE_PATH="/palworld/backups/palworld-save-${DATE}.tar.gz" +cd /palworld/Pal/ + +tar -zcf $FILE_PATH "Saved/" +echo "file dumped at $FILE_PATH" diff --git a/scripts/init.sh b/scripts/init.sh index 7b7a75b44..f1b5bf2a5 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -9,7 +9,7 @@ else exit 1 fi -mkdir -p /palworld +mkdir -p /palworld/backups chown -R steam:steam /palworld if [ "${UPDATE_ON_BOOT}" = true ]; then From 4c9465fefc2dd437aaf557599ea60280a190af5a Mon Sep 17 00:00:00 2001 From: piravit chenpittaya Date: Wed, 24 Jan 2024 18:27:03 +0700 Subject: [PATCH 2/4] format datetime --- scripts/dump_save.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dump_save.sh b/scripts/dump_save.sh index f94f14232..b4d5568f3 100644 --- a/scripts/dump_save.sh +++ b/scripts/dump_save.sh @@ -1,6 +1,6 @@ #!/bin/bash -DATE=$(date +"%d-%m-%Y") +DATE=$(date +"%Y-%m-%d_%H-%M-%S") FILE_PATH="/palworld/backups/palworld-save-${DATE}.tar.gz" cd /palworld/Pal/ From 5ebfd4c62dff91af76097c1f28fbe88941a2b29f Mon Sep 17 00:00:00 2001 From: Piravit Chenpittaya Date: Wed, 24 Jan 2024 18:32:59 +0700 Subject: [PATCH 3/4] Update README.md add Dump Save usage --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index d098b7ecd..308aa86f4 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,14 @@ This will open a CLI that use can use to write commands to the Palworld Server. For a full list of commands go to: [https://tech.palworldgame.com/server-commands](https://tech.palworldgame.com/server-commands) +## Dump Save + +To create a backup of the game's save at the current point in time, use the command. + +```bash +docker exec palworld-server dump_save +``` + ## Editing Server Settings When the server starts, a `PalWorldSettings.ini` file will be created in the following location: `/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini` From 2707fc5525bb0e6e68a8ec31e262bf2be0b7b060 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Wed, 24 Jan 2024 12:52:48 +0100 Subject: [PATCH 4/4] Rename dump save to backup & add to readme --- Dockerfile | 4 ++-- README.md | 6 ++++-- scripts/{dump_save.sh => backup.sh} | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) rename scripts/{dump_save.sh => backup.sh} (53%) diff --git a/Dockerfile b/Dockerfile index ce405ac33..5978229f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,9 +28,9 @@ ENV PORT= \ QUERY_PORT=27015 COPY ./scripts/* /home/steam/server/ -RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/dump_save.sh +RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/backup.sh -RUN mv /home/steam/server/dump_save.sh /usr/local/bin/dump_save +RUN mv /home/steam/server/backup.sh /usr/local/bin/backup WORKDIR /home/steam/server diff --git a/README.md b/README.md index 308aa86f4..612f6a4c9 100644 --- a/README.md +++ b/README.md @@ -152,14 +152,16 @@ This will open a CLI that use can use to write commands to the Palworld Server. For a full list of commands go to: [https://tech.palworldgame.com/server-commands](https://tech.palworldgame.com/server-commands) -## Dump Save +## Creating a backup To create a backup of the game's save at the current point in time, use the command. ```bash -docker exec palworld-server dump_save +docker exec palworld-server backup ``` +This will create a backup at `/palworld/backups/` + ## Editing Server Settings When the server starts, a `PalWorldSettings.ini` file will be created in the following location: `/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini` diff --git a/scripts/dump_save.sh b/scripts/backup.sh similarity index 53% rename from scripts/dump_save.sh rename to scripts/backup.sh index b4d5568f3..9cca79259 100644 --- a/scripts/dump_save.sh +++ b/scripts/backup.sh @@ -2,7 +2,7 @@ DATE=$(date +"%Y-%m-%d_%H-%M-%S") FILE_PATH="/palworld/backups/palworld-save-${DATE}.tar.gz" -cd /palworld/Pal/ +cd /palworld/Pal/ || exit -tar -zcf $FILE_PATH "Saved/" -echo "file dumped at $FILE_PATH" +tar -zcf "$FILE_PATH" "Saved/" +echo "backup created at $FILE_PATH"