From bd7d812e94a0147aab32b9ea718fb77add713503 Mon Sep 17 00:00:00 2001 From: FailedProxy Date: Sat, 21 Mar 2026 22:33:25 +0000 Subject: [PATCH] Added exclude function --- Rsync/rsync.sh | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Rsync/rsync.sh b/Rsync/rsync.sh index 38fad33..9f8c01d 100644 --- a/Rsync/rsync.sh +++ b/Rsync/rsync.sh @@ -1,25 +1,24 @@ #!/bin/bash set -e #----------------------------------------------------------------------------------------------- -#----------------- User Variables, Please adjust in Master.cong as needed ---------------------- +#----------------- User Variables, Please adjust in Master.conf as needed ---------------------- #----------------------------------------------------------------------------------------------- # This is the main Core Rsync script # -# User vaiables can be adjusted in Master.conf -# scripts now just contain runtime codes +# User variables can be adjusted in Master.conf +# Scripts now just contain runtime logic # # This allows for profiles and multiple things to use the core script -# use arguments in unRAID User Plugin for directory -# Example = /mnt/user/appdata/unraid_scripts/Rsync/rsync.sh -# /mnt/user/appdata-test/Arrs/ +# Use arguments in unRAID User Plugin for directory +# Example: /mnt/user/appdata/unraid_scripts/Rsync/rsync.sh /mnt/user/appdata-test/Arrs/ # # /mnt/user/appdata-test/Arrs/ is the argument -# If the last name /Arrs/ matches a profile in Master.conf then profiles are used -# If no matches then Global Configureation is used in Master.conf -# +# If the last name /Arrs/ matches a profile in Master.conf, then profile defaults are used +# Otherwise, global configuration in Master.conf is used #----------------------------------------------------------------------------------------------- -#---------------End Of User Variables, Please adjust in Master.cong as needed ------------------ +#---------------End Of User Variables ---------------------------------------------------------- #----------------------------------------------------------------------------------------------- + # Detect script directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -74,9 +73,9 @@ DELAYED_CONTAINERS=(${PROFILE_DELAYED_CONTAINERS[$PROFILE_NAME]}) CONTAINER_DELAY=${PROFILE_CONTAINER_DELAY[$PROFILE_NAME]:-$CONTAINER_DELAY} RETRY_COUNT=${PROFILE_RETRY_COUNT[$PROFILE_NAME]:-$RETRY_COUNT} SLEEP=${PROFILE_SLEEP[$PROFILE_NAME]:-$SLEEP} -EXCLUDE_DIRS=(${PROFILE_EXCLUDE_DIRS[$PROFILE_NAME]}) +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[*]}" +echo "Settings: MAX_RSYNC_PROCS=$MAX_RSYNC_PROCS, BW_LIMIT=$BW_LIMIT, CONTAINERS=${CRITICAL_CONTAINER_NAMES[*]}, EXCLUDES=${EXCLUDE_DIRS[*]}" # Dependency check for cmd in rsync ssh ping timeout docker tailscale; do @@ -134,7 +133,6 @@ start_containers() { done } - # Main sync logic main() { echo "[$LOCAL_SERVER_NAME] Syncing $DIRECTORY → $REMOTE_SERVER:$DIRECTORY" @@ -162,6 +160,11 @@ main() { --no-whole-file ) + # Apply profile-specific excludes + for ex in "${EXCLUDE_DIRS[@]}"; do + RSYNC_OPTS+=(--exclude="$ex") + done + [ "$DRY_RUN" = true ] && RSYNC_OPTS+=("--dry-run") for attempt in $(seq 1 "$RETRY_COUNT"); do