mirror of
https://github.com/YuzuZensai/palworld-server-docker.git
synced 2026-01-06 04:32:43 +00:00
23 lines
589 B
Bash
23 lines
589 B
Bash
#!/bin/bash
|
|
|
|
if [ "${RCON_ENABLED}" = true ]; then
|
|
rcon-cli -c /home/steam/server/rcon.yaml save
|
|
fi
|
|
|
|
DATE=$(date +"%Y-%m-%d_%H-%M-%S")
|
|
FILE_PATH="/palworld/backups/palworld-save-${DATE}.tar.gz"
|
|
cd /palworld/Pal/ || exit
|
|
|
|
tar -zcf "$FILE_PATH" "Saved/"
|
|
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
chown steam:steam "$FILE_PATH"
|
|
fi
|
|
|
|
echo "backup created at $FILE_PATH"
|
|
|
|
if [ "${DELETE_OLD_BACKUPS}" = true ]; then
|
|
echo "removing backups older than ${OLD_BACKUP_DAYS:=30} days"
|
|
find /palworld/backups/ -mindepth 1 -maxdepth 1 -mtime "+${OLD_BACKUP_DAYS}" -print -delete
|
|
fi
|