-
-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into isWritable-Update-for-NFS
- Loading branch information
Showing
10 changed files
with
272 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,43 @@ | ||
#!/bin/bash | ||
# shellcheck source=/dev/null | ||
source "/home/steam/server/helper_functions.sh" | ||
|
||
if [ -n "${DISCORD_WEBHOOK_URL}" ]; then | ||
/home/steam/server/discord.sh "Creating backup..." "in-progress" & | ||
fi | ||
|
||
DiscordMessage "Creating backup..." "in-progress" | ||
if [ "${RCON_ENABLED,,}" = true ]; then | ||
rcon-cli -c /home/steam/server/rcon.yaml save | ||
RCON save | ||
fi | ||
|
||
DATE=$(date +"%Y-%m-%d_%H-%M-%S") | ||
FILE_PATH="/palworld/backups/palworld-save-${DATE}.tar.gz" | ||
cd /palworld/Pal/ || exit | ||
|
||
echo "Creating backup" | ||
LogAction "Creating backup" | ||
tar -zcf "$FILE_PATH" "Saved/" | ||
|
||
if [ "$(id -u)" -eq 0 ]; then | ||
chown steam:steam "$FILE_PATH" | ||
fi | ||
LogInfo "Backup created at ${FILE_PATH}" | ||
DiscordMessage "Backup created at ${FILE_PATH}" "success" | ||
|
||
if [ "${DELETE_OLD_BACKUPS,,}" != true ]; then | ||
exit 0 | ||
fi | ||
|
||
if [ -z "${OLD_BACKUP_DAYS}" ]; then | ||
LogWarn "Unable to delete old backups, OLD_BACKUP_DAYS is empty." | ||
DiscordMessage "Unable to delete old backups, OLD_BACKUP_DAYS is empty." "warn" | ||
exit 0 | ||
fi | ||
|
||
echo "Backup created at ${FILE_PATH}" | ||
if [ -n "${DISCORD_WEBHOOK_URL}" ]; then | ||
/home/steam/server/discord.sh "Backup created at ${FILE_PATH}" "success" | ||
if [[ "${OLD_BACKUP_DAYS}" =~ ^[0-9]+$ ]]; then | ||
LogAction "Removing Old Backups" | ||
LogInfo "Removing backups older than ${OLD_BACKUP_DAYS} days" | ||
DiscordMessage "Removing backups older than ${OLD_BACKUP_DAYS} days..." "in-progress" | ||
find /palworld/backups/ -mindepth 1 -maxdepth 1 -mtime "+${OLD_BACKUP_DAYS}" -type f -name 'palworld-save-*.tar.gz' -print -delete | ||
DiscordMessage "Removed backups older than ${OLD_BACKUP_DAYS} days" "success" | ||
exit 0 | ||
fi | ||
|
||
if [ "${DELETE_OLD_BACKUPS,,}" = true ]; then | ||
|
||
if [ -z "${OLD_BACKUP_DAYS}" ]; then | ||
echo "Unable to delete old backups, OLD_BACKUP_DAYS is empty." | ||
if [ -n "${DISCORD_WEBHOOK_URL}" ]; then | ||
/home/steam/server/discord.sh "Unable to delete old backups, OLD_BACKUP_DAYS is empty." "warn" | ||
fi | ||
elif [[ "${OLD_BACKUP_DAYS}" =~ ^[0-9]+$ ]]; then | ||
echo "Removing backups older than ${OLD_BACKUP_DAYS} days" | ||
if [ -n "${DISCORD_WEBHOOK_URL}" ] && [ -n "${DISCORD_PRE_BACKUP_DELETE_MESSAGE}" ]; then | ||
/home/steam/server/discord.sh "Removing backups older than ${OLD_BACKUP_DAYS} days..." "in-progress" & | ||
fi | ||
find /palworld/backups/ -mindepth 1 -maxdepth 1 -mtime "+${OLD_BACKUP_DAYS}" -type f -name 'palworld-save-*.tar.gz' -print -delete | ||
if [ -n "${DISCORD_WEBHOOK_URL}" ]; then | ||
/home/steam/server/discord.sh "Removed backups older than ${OLD_BACKUP_DAYS} days" "success" | ||
fi | ||
else | ||
echo "Unable to delete old backups, OLD_BACKUP_DAYS is not an integer. OLD_BACKUP_DAYS=${OLD_BACKUP_DAYS}" | ||
if [ -n "${DISCORD_WEBHOOK_URL}" ]; then | ||
/home/steam/server/discord.sh "Unable to delete old backups, OLD_BACKUP_DAYS is not an integer. OLD_BACKUP_DAYS=${OLD_BACKUP_DAYS}" "failure" | ||
fi | ||
fi | ||
fi | ||
LogError "Unable to delete old backups, OLD_BACKUP_DAYS is not an integer. OLD_BACKUP_DAYS=${OLD_BACKUP_DAYS}" | ||
DiscordMessage "Unable to delete old backups, OLD_BACKUP_DAYS is not an integer. OLD_BACKUP_DAYS=${OLD_BACKUP_DAYS}" "failure" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.