updated
This commit is contained in:
@@ -1,12 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Detect script directory
|
# Detect script directory
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
# Load Master.conf from Git repo
|
# Load Master.conf from Git repo
|
||||||
MASTER_CONF="$SCRIPT_DIR/../Master.conf"
|
MASTER_CONF="$SCRIPT_DIR/../Master.conf"
|
||||||
|
|
||||||
if [ -f "$MASTER_CONF" ]; then
|
if [ -f "$MASTER_CONF" ]; then
|
||||||
source "$MASTER_CONF"
|
source "$MASTER_CONF"
|
||||||
echo "Loaded Master.conf from $MASTER_CONF"
|
echo "Loaded Master.conf from $MASTER_CONF"
|
||||||
@@ -18,8 +15,7 @@ fi
|
|||||||
#-----------------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------
|
||||||
#----------------------------- User Variables, Please adjust as needed -------------------------
|
#----------------------------- User Variables, Please adjust as needed -------------------------
|
||||||
#-----------------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------
|
||||||
LOCAL_DIR="/mnt/user/appdata-Failover/Arrs_Stack/"
|
DIRECTORY="/mnt/user/appdata-Failover/Arrs_Stack/"
|
||||||
REMOTE_DIR="/mnt/user/appdata-Failover/Arrs_Stack/"
|
|
||||||
DRY_RUN=false
|
DRY_RUN=false
|
||||||
CRITICAL_CONTAINER_NAMES=("Sonarr" "Lidarr" "Readarr" "Radarr" "Prowlarr" "Bazarr" "Pinchflat")
|
CRITICAL_CONTAINER_NAMES=("Sonarr" "Lidarr" "Readarr" "Radarr" "Prowlarr" "Bazarr" "Pinchflat")
|
||||||
DELAYED_CONTAINERS=("")
|
DELAYED_CONTAINERS=("")
|
||||||
@@ -89,7 +85,7 @@ start_containers() {
|
|||||||
|
|
||||||
# Main sync logic
|
# Main sync logic
|
||||||
main() {
|
main() {
|
||||||
echo "[$LOCAL_SERVER_NAME] Syncing to ${REMOTE_SERVER_NAME}..."
|
echo "[$LOCAL_SERVER_NAME] Syncing $DIRECTORY → $REMOTE_SERVER:$DIRECTORY"
|
||||||
|
|
||||||
for i in $(seq 1 "$RETRY_COUNT"); do
|
for i in $(seq 1 "$RETRY_COUNT"); do
|
||||||
if check_server_online; then
|
if check_server_online; then
|
||||||
@@ -100,7 +96,7 @@ main() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
check_server_online || { echo "Remote $REMOTE_SERVER_NAME unreachable. Exiting."; exit 1; }
|
check_server_online || { echo "Remote $REMOTE_SERVER_NAME unreachable. Exiting."; exit 1; }
|
||||||
echo "[$LOCAL_SERVER_NAME] Syncing $LOCAL_DIR → $REMOTE_SERVER:$REMOTE_DIR"
|
|
||||||
wait_for_rsync
|
wait_for_rsync
|
||||||
stop_containers
|
stop_containers
|
||||||
|
|
||||||
@@ -124,7 +120,7 @@ main() {
|
|||||||
echo "Starting rsync attempt $attempt/$RETRY_COUNT..."
|
echo "Starting rsync attempt $attempt/$RETRY_COUNT..."
|
||||||
if rsync "${RSYNC_OPTS[@]}" \
|
if rsync "${RSYNC_OPTS[@]}" \
|
||||||
-e "ssh -i \"$SSH_KEY\" -T -o Compression=no -o IPQoS=throughput" \
|
-e "ssh -i \"$SSH_KEY\" -T -o Compression=no -o IPQoS=throughput" \
|
||||||
"$LOCAL_DIR" "root@${REMOTE_SERVER}:$REMOTE_DIR"; then
|
"$DIRECTORY" "root@${REMOTE_SERVER}:$DIRECTORY"; then
|
||||||
echo "Rsync completed successfully."
|
echo "Rsync completed successfully."
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user