From 267560ec1278e3f106bac51b7d2a29fa64b66651 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Wed, 31 Jan 2024 19:58:57 -0500 Subject: [PATCH] Added waiting for backups to complete before stopping --- scripts/backup.sh | 1 + scripts/init.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/scripts/backup.sh b/scripts/backup.sh index 3f7c845fd..c659f0c50 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -8,6 +8,7 @@ DATE=$(date +"%Y-%m-%d_%H-%M-%S") FILE_PATH="/palworld/backups/palworld-save-${DATE}.tar.gz" cd /palworld/Pal/ || exit +echo "Creating backup" tar -zcf "$FILE_PATH" "Saved/" if [ "$(id -u)" -eq 0 ]; then diff --git a/scripts/init.sh b/scripts/init.sh index 24c3fac10..7dd492e7e 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -28,3 +28,9 @@ su steam -c ./start.sh & # Process ID of su killpid="$!" wait $killpid + +echo "Waiting for backup to finish" +backup_pids=($(pgrep backup)) +for pid in "${backup_pids[@]}"; do + tail --pid=$pid -f 2>/dev/null +done