Updated exclusion to array

This commit is contained in:
2026-03-21 22:40:25 +00:00
parent bd7d812e94
commit 7db77e6445
2 changed files with 12 additions and 16 deletions
+5 -5
View File
@@ -129,11 +129,11 @@ PROFILE_CONTAINER_DELAY["important-data"]=10
PROFILE_CONTAINER_DELAY["emby"]=5 PROFILE_CONTAINER_DELAY["emby"]=5
# Not include logs or other file types during transfer per profile # Not include logs or other file types during transfer per profile
declare -A PROFILE_EXCLUDE_DIRS declare -A PROFILE_EXCLUDE_DIRS
PROFILE_EXCLUDE_DIRS["arrs_stack"]="logs" PROFILE_EXCLUDE_DIRS["arrs_stack"]="logs *.tmp"
PROFILE_EXCLUDE_DIRS["critical-data"]="logs" PROFILE_EXCLUDE_DIRS["critical-data"]="logs *.tmp"
PROFILE_EXCLUDE_DIRS["gmer4lfe"]="logs" PROFILE_EXCLUDE_DIRS["gmer4lfe"]="logs *.tmp"
PROFILE_EXCLUDE_DIRS["important-data"]="logs" PROFILE_EXCLUDE_DIRS["important-data"]="logs *.tmp"
PROFILE_EXCLUDE_DIRS["emby"]="logs" PROFILE_EXCLUDE_DIRS["emby"]="logs *.tmp"
#----------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------
#----------------------------- End of Master Config --------------------------------------------- #----------------------------- End of Master Config ---------------------------------------------
#----------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------
+7 -11
View File
@@ -33,7 +33,7 @@ else
fi fi
# Input Arguments # Input Arguments
DIRECTORY="$1" # Directory to sync DIRECTORY="$1"
if [[ -z "$DIRECTORY" ]]; then if [[ -z "$DIRECTORY" ]]; then
echo "Usage: $0 <directory-to-sync> [--dry-run] [VAR=value ...]" echo "Usage: $0 <directory-to-sync> [--dry-run] [VAR=value ...]"
exit 1 exit 1
@@ -73,16 +73,14 @@ DELAYED_CONTAINERS=(${PROFILE_DELAYED_CONTAINERS[$PROFILE_NAME]})
CONTAINER_DELAY=${PROFILE_CONTAINER_DELAY[$PROFILE_NAME]:-$CONTAINER_DELAY} CONTAINER_DELAY=${PROFILE_CONTAINER_DELAY[$PROFILE_NAME]:-$CONTAINER_DELAY}
RETRY_COUNT=${PROFILE_RETRY_COUNT[$PROFILE_NAME]:-$RETRY_COUNT} RETRY_COUNT=${PROFILE_RETRY_COUNT[$PROFILE_NAME]:-$RETRY_COUNT}
SLEEP=${PROFILE_SLEEP[$PROFILE_NAME]:-$SLEEP} SLEEP=${PROFILE_SLEEP[$PROFILE_NAME]:-$SLEEP}
# Allow multiple patterns per profile
EXCLUDE_DIRS=(${PROFILE_EXCLUDE_DIRS[$PROFILE_NAME]:-${EXCLUDE_DIRS[@]}}) EXCLUDE_DIRS=(${PROFILE_EXCLUDE_DIRS[$PROFILE_NAME]:-${EXCLUDE_DIRS[@]}})
echo "Settings: MAX_RSYNC_PROCS=$MAX_RSYNC_PROCS, BW_LIMIT=$BW_LIMIT, CONTAINERS=${CRITICAL_CONTAINER_NAMES[*]}, EXCLUDES=${EXCLUDE_DIRS[*]}" echo "Settings: MAX_RSYNC_PROCS=$MAX_RSYNC_PROCS, BW_LIMIT=$BW_LIMIT, CONTAINERS=${CRITICAL_CONTAINER_NAMES[*]}, EXCLUDES=${EXCLUDE_DIRS[*]}"
# Dependency check # Dependency check
for cmd in rsync ssh ping timeout docker tailscale; do for cmd in rsync ssh ping timeout docker tailscale; do
command -v "$cmd" >/dev/null 2>&1 || { command -v "$cmd" >/dev/null 2>&1 || { echo "Error: Required command '$cmd' is not installed."; exit 1; }
echo "Error: Required command '$cmd' is not installed."
exit 1
}
done done
trap 'echo "Script interrupted. Exiting."; exit 130' INT TERM trap 'echo "Script interrupted. Exiting."; exit 130' INT TERM
@@ -138,9 +136,7 @@ main() {
echo "[$LOCAL_SERVER_NAME] Syncing $DIRECTORY$REMOTE_SERVER:$DIRECTORY" echo "[$LOCAL_SERVER_NAME] Syncing $DIRECTORY$REMOTE_SERVER:$DIRECTORY"
for i in $(seq 1 "$RETRY_COUNT"); do for i in $(seq 1 "$RETRY_COUNT"); do
if check_server_online; then if check_server_online; then break; fi
break
fi
echo "Remote $REMOTE_SERVER_NAME down, retrying in $SLEEP seconds..." echo "Remote $REMOTE_SERVER_NAME down, retrying in $SLEEP seconds..."
sleep "$SLEEP" sleep "$SLEEP"
done done
@@ -160,9 +156,9 @@ main() {
--no-whole-file --no-whole-file
) )
# Apply profile-specific excludes # Apply multiple exclude patterns
for ex in "${EXCLUDE_DIRS[@]}"; do for pattern in "${EXCLUDE_DIRS[@]}"; do
RSYNC_OPTS+=(--exclude="$ex") RSYNC_OPTS+=(--exclude="$pattern")
done done
[ "$DRY_RUN" = true ] && RSYNC_OPTS+=("--dry-run") [ "$DRY_RUN" = true ] && RSYNC_OPTS+=("--dry-run")