Skip to content

Commit

Permalink
fix some more linting
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsvanloef committed Feb 5, 2024
1 parent 72c61fa commit 4464ba0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions scripts/backup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

if [ -n "${DISCORD_WEBHOOK_ID}" ]; then
/home/steam/server/discord.sh -i "$DISCORD_WEBHOOK_ID" -c "$DISCORD_CONNECT_TIMEOUT" -M "$DISCORD_MAX_TIMEOUT" -m "Creating backup..." -l "in-progress" &
/home/steam/server/discord.sh -i "{$DISCORD_WEBHOOK_ID}" -c "{$DISCORD_CONNECT_TIMEOUT}" -M "{$DISCORD_MAX_TIMEOUT}" -m "Creating backup..." -l "in-progress" &
fi

if [ "${RCON_ENABLED,,}" = true ]; then
Expand All @@ -21,29 +21,29 @@ fi

echo "Backup created at ${FILE_PATH}"
if [ -n "${DISCORD_WEBHOOK_ID}" ]; then
/home/steam/server/discord.sh -i "$DISCORD_WEBHOOK_ID" -c "$DISCORD_CONNECT_TIMEOUT" -M "$DISCORD_MAX_TIMEOUT" -m "Backup created at ${FILE_PATH}" -l "success"
/home/steam/server/discord.sh -i "{$DISCORD_WEBHOOK_ID}" -c "{$DISCORD_CONNECT_TIMEOUT}" -M "{$DISCORD_MAX_TIMEOUT}" -m "Backup created at ${FILE_PATH}" -l "success"
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_ID}" ]; then
/home/steam/server/discord.sh -i "$DISCORD_WEBHOOK_ID" -c "$DISCORD_CONNECT_TIMEOUT" -M "$DISCORD_MAX_TIMEOUT" -m "Unable to delete old backups, OLD_BACKUP_DAYS is empty." -l "warn"
/home/steam/server/discord.sh -i "{$DISCORD_WEBHOOK_ID}" -c "{$DISCORD_CONNECT_TIMEOUT}" -M "{$DISCORD_MAX_TIMEOUT}" -m "Unable to delete old backups, OLD_BACKUP_DAYS is empty." -l "warn"
fi
elif [[ "${OLD_BACKUP_DAYS}" =~ ^[0-9]+$ ]]; then
echo "Removing backups older than ${OLD_BACKUP_DAYS} days"
if [ -n "${DISCORD_WEBHOOK_ID}" ] && [ -n "${DISCORD_PRE_BACKUP_DELETE_MESSAGE}" ]; then
/home/steam/server/discord.sh -i "$DISCORD_WEBHOOK_ID" -c "$DISCORD_CONNECT_TIMEOUT" -M "$DISCORD_MAX_TIMEOUT" -m "Removing backups older than ${OLD_BACKUP_DAYS} days..." -l "in-progress" &
/home/steam/server/discord.sh -i "{$DISCORD_WEBHOOK_ID}" -c "{$DISCORD_CONNECT_TIMEOUT}" -M "{$DISCORD_MAX_TIMEOUT}" -m "Removing backups older than ${OLD_BACKUP_DAYS} days..." -l "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_ID}" ]; then
/home/steam/server/discord.sh -i "$DISCORD_WEBHOOK_ID" -c "$DISCORD_CONNECT_TIMEOUT" -M "$DISCORD_MAX_TIMEOUT" -m "Removed backups older than ${OLD_BACKUP_DAYS} days" -l "success"
/home/steam/server/discord.sh -i "{$DISCORD_WEBHOOK_ID}" -c "{$DISCORD_CONNECT_TIMEOUT}" -M "{$DISCORD_MAX_TIMEOUT}" -m "Removed backups older than ${OLD_BACKUP_DAYS} days" -l "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_ID}" ]; then
/home/steam/server/discord.sh -i "$DISCORD_WEBHOOK_ID" -c "$DISCORD_CONNECT_TIMEOUT" -M "$DISCORD_MAX_TIMEOUT" -m "Unable to delete old backups, OLD_BACKUP_DAYS is not an integer. OLD_BACKUP_DAYS=${OLD_BACKUP_DAYS}" -l "failure"
/home/steam/server/discord.sh -i "{$DISCORD_WEBHOOK_ID}" -c "{$DISCORD_CONNECT_TIMEOUT}" -M "{$DISCORD_MAX_TIMEOUT}" -m "Unable to delete old backups, OLD_BACKUP_DAYS is not an integer. OLD_BACKUP_DAYS=${OLD_BACKUP_DAYS}" -l "failure"
fi
fi
fi
2 changes: 1 addition & 1 deletion scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ chown -R steam:steam /palworld /home/steam/
# shellcheck disable=SC2317
term_handler() {
if [ -n "${DISCORD_WEBHOOK_ID}" ] && [ -n "${DISCORD_PRE_SHUTDOWN_MESSAGE}" ]; then
su steam -c "/home/steam/server/discord.sh -i $DISCORD_WEBHOOK_ID -c $DISCORD_CONNECT_TIMEOUT -M $DISCORD_MAX_TIMEOUT -m '$DISCORD_PRE_SHUTDOWN_MESSAGE' -l in-progress" &
su steam -c "/home/steam/server/discord.sh -i ${DISCORD_WEBHOOK_ID} -c ${DISCORD_CONNECT_TIMEOUT} -M ${DISCORD_MAX_TIMEOUT} -m '${DISCORD_PRE_SHUTDOWN_MESSAGE}' -l in-progress" &
fi

if [ "${RCON_ENABLED,,}" = true ]; then
Expand Down

0 comments on commit 4464ba0

Please sign in to comment.