From 0d513a38bf4d8bd350beb1dd263252301464a768 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Thu, 29 Jan 2026 14:43:52 +0900 Subject: [PATCH] =?UTF-8?q?backup.sh:=20h=C3=A5ndter=20manglende=20ekslude?= =?UTF-8?q?ringsliste?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/backup.sh b/backup.sh index 8fa2839..5fb1581 100755 --- a/backup.sh +++ b/backup.sh @@ -269,27 +269,31 @@ for host in "${hosts[@]}"; do "--log-file=${logdir}/${host}.log.$snapshot_date" ) - exclude_paths_var="${host}_excludes[@]" - exclude_paths=("${!exclude_paths_var}") - for exclude in "${exclude_paths[@]}"; do - command+=("--exclude=${exclude}") - done + exclude_array_name="${host}_excludes" + if declare -p "$exclude_array_name" >/dev/null 2>&1; then + exclude_paths_var="${host}_excludes[@]" + exclude_paths=( "${!exclude_paths_var}" ) + for exclude in "${exclude_paths[@]}"; do + command+=( "--exclude=${exclude}" ) + done + fi if [ -f "/backupz/${host}.exclude" ]; then command+=("--exclude-from=/backupz/${host}.exclude") fi - include_paths_var="${host}_includes[@]" - include_paths=("${!include_paths_var}") - if [ "${#include_paths[@]}" -eq 0 ]; then + include_array_name="${host}_includes" + if declare -p "$include_array_name" >/dev/null 2>&1; then + include_paths_var="${host}_includes[@]" + include_paths=( "${!include_paths_var}" ) + for include in "${include_paths[@]}"; do + command+=("${host_ssh_hostname[$host]:-$host}:$include") + done + else echo "Ingen inkluderingsstier for vert $host, hopper over." continue fi - for include in "${include_paths[@]}"; do - command+=("${host_ssh_hostname[$host]:-$host}:$include") - done - command+=("/backupz/${hosts_output_dir[$host]:-$host}/") echo "Starter backup for vert: $host"