Skip to content

Commit

Permalink
Changed 8 spaces to 4 spacing to match other bash scripts in repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Dashboy1998 committed Jan 31, 2024
1 parent a0ec278 commit b75254e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions scripts/backup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

if [ "${RCON_ENABLED}" = true ]; then
rcon-cli -c /home/steam/server/rcon.yaml save
rcon-cli -c /home/steam/server/rcon.yaml save
fi

DATE=$(date +"%Y-%m-%d_%H-%M-%S")
Expand All @@ -11,18 +11,18 @@ cd /palworld/Pal/ || exit
tar -zcf "$FILE_PATH" "Saved/"

if [ "$(id -u)" -eq 0 ]; then
chown steam:steam "$FILE_PATH"
chown steam:steam "$FILE_PATH"
fi

echo "backup created at $FILE_PATH"

if [ "${DELETE_OLD_BACKUPS}" = true ]; then
if [ -z "${OLD_BACKUP_DAYS}" ]; then
echo "Unable to deleted old backups, OLD_BACKUP_DAYS is empty."
elif [[ "${OLD_BACKUP_DAYS}" =~ ^[0-9]+$ ]]; then
echo "removing backups older than ${OLD_BACKUP_DAYS} days"
find /palworld/backups/ -mindepth 1 -maxdepth 1 -mtime "+${OLD_BACKUP_DAYS}" -type f -name 'palworld-save-*.tar.gz' -print -delete
else
echo "Unable to deleted old backups, OLD_BACKUP_DAYS is not an integer. OLD_BACKUP_DAYS=${OLD_BACKUP_DAYS}"
fi
if [ -z "${OLD_BACKUP_DAYS}" ]; then
echo "Unable to deleted old backups, OLD_BACKUP_DAYS is empty."
elif [[ "${OLD_BACKUP_DAYS}" =~ ^[0-9]+$ ]]; then
echo "removing backups older than ${OLD_BACKUP_DAYS} days"
find /palworld/backups/ -mindepth 1 -maxdepth 1 -mtime "+${OLD_BACKUP_DAYS}" -type f -name 'palworld-save-*.tar.gz' -print -delete
else
echo "Unable to deleted old backups, OLD_BACKUP_DAYS is not an integer. OLD_BACKUP_DAYS=${OLD_BACKUP_DAYS}"
fi
fi

0 comments on commit b75254e

Please sign in to comment.