Skip to content

Commit 9b3b88c

Browse files
author
buildplan
committed
Fix: shellcheck
1 parent b5ba63e commit 9b3b88c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

backup_script.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# ===================== v0.33 - 2025.08.14 ========================
2+
# ===================== v0.33 - 2025.08.15 ========================
33
#
44
# Example backup.conf:
55
# BACKUP_DIRS="/home/user/test/./ /var/www/./"
@@ -366,8 +366,10 @@ run_restore_mode() {
366366
local date_folders=()
367367
local remote_recycle_path="${BOX_DIR%/}/${RECYCLE_BIN_DIR%/}"
368368
mapfile -t date_folders < <(ssh "${SSH_OPTS_ARRAY[@]}" "${SSH_DIRECT_OPTS[@]}" "$BOX_ADDR" "ls -1 \"$remote_recycle_path\"" 2>/dev/null | grep -E '^[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{6}$')
369-
if [[ ${#date_folders[@]} -eq 0 ]]; then
370-
fi
369+
if [[ ${#date_folders[@]} -eq 0 ]]; then
370+
printf "${C_YELLOW}❌ The remote recycle bin is empty or contains no valid backup folders.${C_RESET}\n"
371+
return 1
372+
fi
371373
printf "${C_YELLOW}Select a backup run (date_time) to browse:${C_RESET}\n"
372374
PS3="Your choice: "
373375
select date_choice in "${date_folders[@]}" "Cancel"; do
@@ -694,7 +696,8 @@ for dir in "${DIRS_ARRAY[@]}"; do
694696
RSYNC_EXIT_CODE=${PIPESTATUS[0]}
695697
else
696698
RSYNC_OPTS+=(--info=stats2)
697-
nice -n 19 ionice -c 3 rsync "${RSYNC_OPTS[@]}" "$dir" "$REMOTE_TARGET" > "$RSYNC_LOG_TMP" 2>&1 || RSYNC_EXIT_CODE=$?
699+
nice -n 19 ionice -c 3 rsync "${RSYNC_OPTS[@]}" "$dir" "$REMOTE_TARGET" > "$RSYNC_LOG_TMP" 2>&1
700+
RSYNC_EXIT_CODE=$?
698701
fi
699702
cat "$RSYNC_LOG_TMP" >> "$LOG_FILE"; full_rsync_output+=$'\n'"$(<"$RSYNC_LOG_TMP")"
700703
rm -f "$RSYNC_LOG_TMP"

0 commit comments

Comments
 (0)