This commit is contained in:
2026-03-24 21:07:16 +00:00
parent 49d2921f3b
commit e7250a7150
2 changed files with 114 additions and 46 deletions
+41 -8
View File
@@ -17,15 +17,48 @@
#-----------------------------------------------------------------------------------------------
#-------------------- Host Configuration --------------------
# Define the hostnames of both servers
# Hostnames of both servers
HOST1="unRAID-Gmer4Lfe"
HOST2="unRAID-Jayred365"
# Master.conf
declare -A SSH_KEYS
declare -A SSH_KEYS
# Detect local hostname
LOCAL_HOSTNAME="$(hostname)"
if [[ "$LOCAL_HOSTNAME" == "$HOST1" ]]; then
LOCAL_SERVER_NAME="$HOST1"
REMOTE_SERVER_NAME="$HOST2"
elif [[ "$LOCAL_HOSTNAME" == "$HOST2" ]]; then
LOCAL_SERVER_NAME="$HOST2"
REMOTE_SERVER_NAME="$HOST1"
else
echo "Error: Local hostname ($LOCAL_HOSTNAME) not recognized."
exit 1
fi
echo "Local server: $LOCAL_SERVER_NAME"
echo "Remote server: $REMOTE_SERVER_NAME"
# Remote Server Ip 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
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"
#-----------------------------------------------------------------------------------------------
#----------------- User Variables --------------------------------------------------------------
#-----------------------------------------------------------------------------------------------
@@ -40,13 +73,13 @@ SLEEP=300
# Max number of concurrently running rsync processes
MAX_RSYNC_PROCS=1
# Container start/stop/restart before and after rsync
CRITICAL_CONTAINER_NAMES=()
CRITICAL_CONTAINER_NAMES=("")
# Containers that need delayed before starting
DELAYED_CONTAINERS=()
DELAYED_CONTAINERS=("")
# Delay in seconds between starting containers, useful for things like Authelia
CONTAINER_DELAY=5
# Not include logs during transfer
EXCLUDE_DIRS=()
EXCLUDE_DIRS=("")
#-------------------- unRAID essentail scripts ------------------
# unRAID reboot script user warning time (seconds)
@@ -118,7 +151,7 @@ PROFILE_CONTAINER_DELAY["important-data"]=10
PROFILE_CONTAINER_DELAY["emby"]=5
# Not include logs or other file types during transfer per profile
declare -A PROFILE_EXCLUDE_DIRS
PROFILE_EXCLUDE_DIRS["arrs_stack"]="logs"
PROFILE_EXCLUDE_DIRS["arrs_stack"]="logs *.tmp"
PROFILE_EXCLUDE_DIRS["critical-data"]="logs *.tmp"
PROFILE_EXCLUDE_DIRS["gmer4lfe"]="logs *.tmp"
PROFILE_EXCLUDE_DIRS["important-data"]="logs *.tmp"