Structure Changes

This commit is contained in:
2026-03-21 20:10:18 +00:00
parent 798517baf5
commit 546686ac8c
4 changed files with 123 additions and 235 deletions
+72 -18
View File
@@ -3,13 +3,16 @@
############################## Master Variables for unRAID scripts ################################
##################################################################################################
#-----------------------------------------------------------------------------------------------
#----------------------------- Host Detection ---------------------------------------------------
#-----------------------------------------------------------------------------------------------
# Define the hostnames of both servers
HOST1="unRAID-Gmer4Lfe"
HOST2="unRAID-Jayred365"
# Detect local hostname
LOCAL_HOSTNAME="$(hostname)"
if [[ "$LOCAL_HOSTNAME" == "$HOST1" ]]; then
LOCAL_SERVER_NAME="$HOST1"
REMOTE_SERVER_NAME="$HOST2"
@@ -20,50 +23,101 @@ else
echo "Error: Local hostname ($LOCAL_HOSTNAME) not recognized."
exit 1
fi
echo "Local server: $LOCAL_SERVER_NAME"
echo "Remote server: $REMOTE_SERVER_NAME"
# Resolve Tailscale IP dynamically, This will try to get the Tailscale IPv4 address for that host
#-----------------------------------------------------------------------------------------------
#----------------------------- Remote Server Resolution -----------------------------------------
#-----------------------------------------------------------------------------------------------
# Resolve Tailscale IP dynamically
REMOTE_SERVER=$(tailscale ip -4 "$REMOTE_SERVER_NAME" 2>/dev/null)
if [[ -z "$REMOTE_SERVER" ]]; then
echo "Error: Could not resolve Tailscale IP for $REMOTE_SERVER_NAME"
exit 1
fi
# SSH key mapping per hostpair
#-----------------------------------------------------------------------------------------------
#----------------------------- SSH Key Mapping --------------------------------------------------
#-----------------------------------------------------------------------------------------------
declare -A SSH_KEYS
SSH_KEYS["$HOST1|$HOST2"]="/root/.ssh/Gmer4Lfe-rsync-key"
SSH_KEYS["$HOST2|$HOST1"]="/root/.ssh/Jayred365-rsync-key"
KEY_ID="$LOCAL_SERVER_NAME|$REMOTE_SERVER_NAME"
if [[ -n "${SSH_KEYS[$KEY_ID]}" ]]; then
SSH_KEY="${SSH_KEYS[$KEY_ID]}"
else
echo "Error: No SSH key defined for $LOCAL_SERVER_NAME → $REMOTE_SERVER_NAME"
exit 1
fi
echo "Using SSH key: $SSH_KEY"
# Network speed limit 100Mbps=12500 KB/s, 200Mbps=25600 KB/s
#-----------------------------------------------------------------------------------------------
#----------------------------- Global Defaults --------------------------------------------------
#-----------------------------------------------------------------------------------------------
# Used when a profile does not match
# Network speed limit (KB/s)
BW_LIMIT=12500
# Amount of times to retry
# Retry logic
RETRY_COUNT=3
# Time in seconds waiting to retry
# Sleep between retries (seconds)
SLEEP=300
# Max number of concurrently running rsync processes
MAX_RSYNC_PROCS=1
# Containers to stop/start on backup server
# Container start/stop/restart before and after rsync
CRITICAL_CONTAINER_NAMES=()
# Containers from CRITICAL_CONTAINER_NAMES that should have delayed startup
# Containers that need delayed before starting
DELAYED_CONTAINERS=()
# Time in seconds to delay the listed containers
# Delay in seconds between starting containers, useful for things like Authelia
CONTAINER_DELAY=5
#-----------------------------------------------------------------------------------------------
#----------------------------- Profile System ---------------------------------------------------
#-----------------------------------------------------------------------------------------------
# Profiles are inferred from the directory basename (lowercased)
#-----------------------------------------------------------------------------------------------
#----------------------------- Profile Performance Tuning ---------------------------------------
#-----------------------------------------------------------------------------------------------
# Max rsync processes per profile
declare -A PROFILE_MAX_PROCS
PROFILE_MAX_PROCS["arrs_stack"]=2
PROFILE_MAX_PROCS["movies"]=1
PROFILE_MAX_PROCS["shows"]=1
# Bandwidth limits per profile (KB/s, 0 = unlimited)
declare -A PROFILE_BW_LIMIT
PROFILE_BW_LIMIT["arrs_stack"]=5000
PROFILE_BW_LIMIT["movies"]=0
PROFILE_BW_LIMIT["shows"]=8000
# Retry logic per profile
declare -A PROFILE_RETRY_COUNT
PROFILE_RETRY_COUNT["arrs_stack"]=3
PROFILE_RETRY_COUNT["movies"]=3
PROFILE_RETRY_COUNT["shows"]=3
# Sleep between retries per profile (seconds)
declare -A PROFILE_SLEEP
PROFILE_SLEEP["arrs_stack"]=300
PROFILE_SLEEP["movies"]=300
PROFILE_SLEEP["shows"]=300
# Containers to stop/start per profile (space-separated strings)
declare -A PROFILE_CRITICAL_CONTAINER_NAMES
PROFILE_CRITICAL_CONTAINER_NAMES["arrs_stack"]="Sonarr Lidarr Readarr Radarr Prowlarr Bazarr Pinchflat"
PROFILE_CRITICAL_CONTAINER_NAMES["movies"]=""
PROFILE_CRITICAL_CONTAINER_NAMES["shows"]=""
# Delayed containers per profile (space-separated strings)
declare -A PROFILE_DELAYED_CONTAINERS
PROFILE_DELAYED_CONTAINERS["arrs_stack"]=""
PROFILE_DELAYED_CONTAINERS["movies"]=""
PROFILE_DELAYED_CONTAINERS["shows"]=""
# Delay in seconds before starting delayed containers per profile
declare -A PROFILE_CONTAINER_DELAY
PROFILE_CONTAINER_DELAY["arrs_stack"]=5
PROFILE_CONTAINER_DELAY["movies"]=0
PROFILE_CONTAINER_DELAY["shows"]=0
#-----------------------------------------------------------------------------------------------
#----------------------------- End of Master Config ---------------------------------------------
#-----------------------------------------------------------------------------------------------