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

Wait for the server to shutdown before restoring a backup #378

Merged
merged 4 commits into from
Feb 14, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions scripts/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ if [ -f "$BACKUP_FILE" ]; then
echo "RCON is not enabled. Please enable RCON to use this feature. Unable to restore backup."
exit 1
fi

while [ -n "$(pidof PalServer-Linux-Test)" ]
do
echo "Waiting for Palworld to exit.."
sleep 1
done
Luatan marked this conversation as resolved.
Show resolved Hide resolved
printf "\e[0;32mShutdown complete.\e[0m\n"

trap - ERR
Expand Down Expand Up @@ -103,6 +109,9 @@ if [ -f "$BACKUP_FILE" ]; then
# Decompress the backup file in tmp directory
tar -zxvf "$BACKUP_FILE" -C "$TMP_PATH"

# Make sure Saves with a different ID are removed before restoring the save
rm -rf "$RESTORE_PATH/Saved/"

Luatan marked this conversation as resolved.
Show resolved Hide resolved
# Move the backup file to the restore directory
\cp -rf -f "$TMP_PATH/Saved/" "$RESTORE_PATH"

Expand Down