updated rsync for switch

This commit is contained in:
2026-04-12 00:14:18 -04:00
parent 1dd11894ce
commit 30da5e1477
+28 -13
View File
@@ -2,6 +2,14 @@
# ----------------------------------------------------------------------------------------------
# --------------------------------- Rsync Core Script ------------------------------------------
# ----------------------------------------------------------------------------------------------
# Core rsync script — called per share or per appdata profile.
# Profile is inferred from the directory basename (lowercased).
# If no profile match is found all settings fall through to global defaults in Master.conf.
#
# Usage:
# rsync.sh /mnt/user/Movies — media share, uses global defaults
# rsync.sh /mnt/user/appdata-Failover/Arrs_Stack — matched to [arrs_stack] profile
# rsync.sh /mnt/user/appdata-Failover/Arrs_Stack --dry-run --log
# ---------------- User Variables, Please adjust in Master.conf as needed ----------------------
# ----------------------------------------------------------------------------------------------
@@ -37,17 +45,6 @@ echo "━━━ $ICON_GEAR Setup ━━━"
detect_hosts
resolve_remote_ip
# -----------------------------------------------------------------------------------------------
# ━━━ $ICON_SHIELD Pre-flight Checks ━━━
# -----------------------------------------------------------------------------------------------
echo ""
echo "━━━ $ICON_SHIELD Pre-flight Checks ━━━"
check_connectivity
check_remote_rootfs
check_remote_share "$DIRECTORY"
check_remote_disks "$DIRECTORY"
# -----------------------------------------------------------------------------------------------
# Profile is inferred from the directory basename (lowercased)
# e.g. /mnt/user/appdata-Failover/Arrs_Stack → arrs_stack
@@ -67,8 +64,27 @@ read -r -a CRITICAL_CONTAINER_NAMES <<< "${PROFILE_CRITICAL_CONTAINER_NAMES[$PRO
read -r -a DELAYED_CONTAINERS <<< "${PROFILE_DELAYED_CONTAINERS[$PROFILE_NAME]:-}"
read -r -a EXCLUDE_DIRS <<< "${PROFILE_EXCLUDE_DIRS[$PROFILE_NAME]:-}"
# Disk check toggle — true = skip per-disk check (ZFS pool), false = run check (array disks)
SKIP_DISK_CHECK=${PROFILE_SKIP_DISK_CHECK[$PROFILE_NAME]:-false}
[[ "$SHOW_STATUS" == true ]] && show_status && exit 0
# -----------------------------------------------------------------------------------------------
# ━━━ $ICON_SHIELD Pre-flight Checks ━━━
# -----------------------------------------------------------------------------------------------
echo ""
echo "━━━ $ICON_SHIELD Pre-flight Checks ━━━"
check_connectivity
check_remote_rootfs
check_remote_share "$DIRECTORY"
if [[ "$SKIP_DISK_CHECK" == "true" ]]; then
info "$ICON_DISK Disk check skipped for profile [$PROFILE_NAME] — ZFS pool on remote"
else
check_remote_disks "$DIRECTORY"
fi
# -----------------------------------------------------------------------------------------------
# ━━━ $ICON_STOP $ICON_CONTAINERS Containers ━━━
# -----------------------------------------------------------------------------------------------
@@ -102,8 +118,6 @@ RSYNC_SUCCESS=false
for i in $(seq 1 "$RETRY_COUNT"); do
info "$ICON_RETRY Attempt $i of $RETRY_COUNT..."
# dirname "$DIRECTORY" is intentional — rsync places the directory itself on the remote
# e.g. source /mnt/user/Movies syncs to remote /mnt/user/Movies (not /mnt/user/Movies/Movies)
if rsync "${RSYNC_OPTS[@]}" \
-e "ssh -i $SSH_KEY -T -o Compression=no -o IPQoS=throughput" \
"$DIRECTORY" "root@${REMOTE_SERVER}:$(dirname "$DIRECTORY")/"; then
@@ -133,6 +147,7 @@ echo ""
echo "━━━━━ $ICON_SUMMARY SUMMARY ━━━━━"
echo "$ICON_RUN Directory: $DIRECTORY"
echo "$ICON_GEAR Profile: $PROFILE_NAME"
echo "$ICON_DISK Disk check: $([[ "$SKIP_DISK_CHECK" == "true" ]] && echo "skipped (ZFS pool)" || echo "passed")"
echo "$ICON_TIME Duration: $(format_duration $((END - START)))"
if [[ "$RSYNC_SUCCESS" == true ]]; then
echo "$ICON_DONE Status: $ICON_SUCCESS DONE"