updated my variables in master.conf

This commit is contained in:
2026-04-14 17:38:44 -04:00
parent f1529db3a0
commit 6f2e19265b
4 changed files with 110 additions and 80 deletions
+26 -9
View File
@@ -6,6 +6,9 @@
# Profile is inferred from the directory basename (lowercased).
# If no profile match is found all settings fall through to global defaults in Master.conf.
#
# After each successful sync, logs the transfer to bandwidth_monitor.sh for weekly reporting.
# Log entry: date | time | profile | duration | status
#
# Usage:
# rsync.sh /mnt/user/Movies — media share, uses global defaults
# rsync.sh /mnt/user/appdata-Failover/Arrs_Stack — matched to [arrs_stack] profile
@@ -20,7 +23,6 @@ source "$SCRIPT_DIR/../common.sh"
# -----------------------------------------------------------------------------------------------
# Separate the positional directory argument from flag/key=value args.
# Flags and key=value pairs are passed to parse_args — directory is handled here.
# -----------------------------------------------------------------------------------------------
DIRECTORY=""
RAW_ARGS=()
@@ -46,25 +48,24 @@ detect_hosts
resolve_remote_ip
# -----------------------------------------------------------------------------------------------
# Profile is inferred from the directory basename (lowercased)
# e.g. /mnt/user/appdata-Failover/Arrs_Stack → arrs_stack
# Profile inference — basename of directory lowercased
# -----------------------------------------------------------------------------------------------
echo ""
PROFILE_NAME=$(basename "$DIRECTORY" | tr '[:upper:]' '[:lower:]')
info "$ICON_GEAR Loading profile: $PROFILE_NAME"
# Scalar overrides — use profile value if defined, fall back to global default
# Scalar overrides
BW_LIMIT=${PROFILE_BW_LIMIT[$PROFILE_NAME]:-$BW_LIMIT}
RETRY_COUNT=${PROFILE_RETRY_COUNT[$PROFILE_NAME]:-$RETRY_COUNT}
SLEEP=${PROFILE_SLEEP[$PROFILE_NAME]:-$SLEEP}
CONTAINER_DELAY=${PROFILE_CONTAINER_DELAY[$PROFILE_NAME]:-$CONTAINER_DELAY}
# Array overrides — profile strings must be converted to bash arrays before use
# Array overrides
read -r -a CRITICAL_CONTAINER_NAMES <<< "${PROFILE_CRITICAL_CONTAINER_NAMES[$PROFILE_NAME]:-}"
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)
# Disk check toggle
SKIP_DISK_CHECK=${PROFILE_SKIP_DISK_CHECK[$PROFILE_NAME]:-false}
[[ "$SHOW_STATUS" == true ]] && show_status && exit 0
@@ -105,7 +106,7 @@ echo ""
get_rsync_opts
# Append profile excludes to rsync options
# Append profile excludes
for ex in "${EXCLUDE_DIRS[@]}"; do
[[ -n "$ex" ]] && RSYNC_OPTS+=(--exclude="$ex")
done
@@ -139,6 +140,21 @@ echo "━━━ $ICON_START $ICON_CONTAINERS Containers ━━━"
start_containers
END=$(date +%s)
DURATION=$((END - START))
# -----------------------------------------------------------------------------------------------
# Log transfer to bandwidth monitor — only on successful non-dry-run syncs
# Reliable format: date|time|profile|duration|status
# Does not parse rsync output — version-proof and always works
# -----------------------------------------------------------------------------------------------
BANDWIDTH_MONITOR="$SCRIPT_DIR/../Monitor/bandwidth_monitor.sh"
if [[ "$DRY_RUN" == false ]] && [[ -f "$BANDWIDTH_MONITOR" ]]; then
STATUS="success"
[[ "$RSYNC_SUCCESS" == false ]] && STATUS="failed"
bash "$BANDWIDTH_MONITOR" --log-transfer "$PROFILE_NAME" "$DURATION" "$STATUS"
log "$ICON_BANDWIDTH Transfer logged to bandwidth monitor"
fi
# -----------------------------------------------------------------------------------------------
# ━━━ Summary ━━━
@@ -148,10 +164,11 @@ 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)))"
echo "$ICON_TIME Duration: $(format_duration $DURATION)"
if [[ "$RSYNC_SUCCESS" == true ]]; then
echo "$ICON_DONE Status: $ICON_SUCCESS DONE"
notify "Rsync complete — $DIRECTORY ($PROFILE_NAME) in $(format_duration $((END - START)))" "Rsync" "normal"
notify "Rsync complete — $DIRECTORY ($PROFILE_NAME) in $(format_duration $DURATION)" "Rsync" "normal"
else
echo "$ICON_ERROR Status: $ICON_ERROR FAILED after $RETRY_COUNT attempts"
notify "Rsync failed — $DIRECTORY ($PROFILE_NAME) after $RETRY_COUNT attempts" "Rsync" "warning"