139 lines
4.7 KiB
Bash
139 lines
4.7 KiB
Bash
#!/bin/bash
|
|
# ----------------------------------------------------------------------------------------------
|
|
# ---------------------------- Master Variables for unRAID scripts -----------------------------
|
|
# ----------------------------------------------------------------------------------------------
|
|
|
|
# ----------------------- Host Configuration --------------------
|
|
# List the Hostnames of both servers
|
|
HOST1="unRAID-Gmer4Lfe"
|
|
HOST2="unRAID-Jayred365"
|
|
# Assign SSH keys for each host pair (adjust paths as needed) HOST1 from above
|
|
# Must have its key added to HOST1_SSH_Key same applies for HOST2
|
|
HOST1_SSH_KEY="/root/.ssh/Gmer4Lfe-rsync-key"
|
|
HOST2_SSH_KEY="/root/.ssh/Jayred365-rsync-key"
|
|
|
|
# -------------------------- Logging ----------------------------
|
|
ENABLE_LOGGING=true # false = only echo user-facing messages
|
|
|
|
# ------------------ Git, Pull & Execute Script -----------------
|
|
REPO_SSH="git@192.168.50.2:FailedProxy/Unraid_Scripts.git"
|
|
TARGET_DIR="/mnt/user/appdata/unraid_scripts"
|
|
SSH_KEY="/root/.ssh/id_gitea_rsync"
|
|
SSH_PORT=221
|
|
|
|
# -------------------Rsync Script Defaults-----------------------
|
|
# turns on or off progress info for rsync
|
|
ENABLE_PROGRESS=true
|
|
# Network speed limit (KB/s)
|
|
BW_LIMIT=12500
|
|
# Retry logic
|
|
RETRY_COUNT=3
|
|
# Sleep between retries (seconds)
|
|
SLEEP=300
|
|
# Max number of concurrently running rsync processes
|
|
MAX_RSYNC_PROCS=1
|
|
# Container start/stop/restart before and after rsync
|
|
CRITICAL_CONTAINER_NAMES=()
|
|
# Containers that need delayed before starting
|
|
DELAYED_CONTAINERS=()
|
|
# Delay in seconds between starting containers, useful for things like Authelia
|
|
CONTAINER_DELAY=5
|
|
# Not include logs during transfer
|
|
EXCLUDE_DIRS=()
|
|
# Default global rsync options
|
|
DEFAULT_RSYNC_OPTS=(-av --info=progress2 --human-readable --bwlimit="$BW_LIMIT" --delete --inplace --no-whole-file)
|
|
|
|
# ------------------- unRAID essentail scripts ------------------
|
|
# unRAID reboot script user warning time (seconds)
|
|
REBOOT_SLEEP=300
|
|
# unRAID mover stop script timeout (seconds)
|
|
MOVER_STOP_TIMEOUT=300
|
|
# docker_syslog_filter.sh filter file path
|
|
FILTER_FILE="/etc/rsyslog.d/ignore-docker-veth.conf"
|
|
# php_fpm_max_children.sh php-fpm config file path
|
|
PHP_CONF="/etc/php-fpm.d/www.conf"
|
|
# php_fpm_max_children.sh max children value
|
|
PHP_MAX_CHILDREN=250
|
|
|
|
# --------------------- Profile System -------------------------
|
|
# Profiles are inferred from the directory basename (lowercased)
|
|
# Profile-specific rsync options (override global) must list all options as they do not inherit from global
|
|
|
|
# SPACE-SEPARATED STRINGS
|
|
declare -A PROFILE_RSYNC_OPTS=(
|
|
[arrs_stack]="-av --info=progress2 --human-readable --bwlimit=$BW_LIMIT --delete --inplace"
|
|
[critical-data]="-av --human-readable --bwlimit=$BW_LIMIT --delete"
|
|
[gmer4lfe]="-av --info=progress2 --bwlimit=$BW_LIMIT"
|
|
[important-data]="-av --human-readable --bwlimit=$BW_LIMIT"
|
|
[emby]="-av --human-readable --bwlimit=$BW_LIMIT"
|
|
)
|
|
|
|
declare -A PROFILE_MAX_PROCS=(
|
|
[arrs_stack]=2
|
|
[critical-data]=2
|
|
[gmer4lfe]=1
|
|
[important-data]=2
|
|
[emby]=1
|
|
)
|
|
|
|
declare -A PROFILE_BW_LIMIT=(
|
|
[arrs_stack]=5000
|
|
[critical-data]=9500
|
|
[gmer4lfe]=8000
|
|
[important-data]=9500
|
|
[emby]=8000
|
|
)
|
|
|
|
declare -A PROFILE_RETRY_COUNT=(
|
|
[arrs_stack]=3
|
|
[critical-data]=3
|
|
[gmer4lfe]=3
|
|
[important-data]=3
|
|
[emby]=3
|
|
)
|
|
|
|
declare -A PROFILE_SLEEP=(
|
|
[arrs_stack]=300
|
|
[critical-data]=300
|
|
[gmer4lfe]=300
|
|
[important-data]=300
|
|
[emby]=300
|
|
)
|
|
|
|
# SPACE-SEPARATED STRINGS
|
|
declare -A PROFILE_CRITICAL_CONTAINER_NAMES=(
|
|
[arrs_stack]="Sonarr Lidarr Readarr Radarr Prowlarr Bazarr Pinchflat"
|
|
[critical-data]="Mariadb-Authelia Redis-Authelia Lldap-Gmer4Lfe NginxProxyManager Authelia"
|
|
[gmer4lfe]="Organizrv2-Gmer4Lfe UptimeKuma-Gmer4Lfe VaultWarden-Gmer4Lfe"
|
|
[important-data]="Postgres-NextCloud NextCloud"
|
|
[emby]=""
|
|
)
|
|
|
|
# SPACE-SEPARATED STRINGS — containers that need a delay before starting
|
|
declare -A PROFILE_DELAYED_CONTAINERS=(
|
|
[arrs_stack]=""
|
|
[critical-data]="Authelia"
|
|
[gmer4lfe]=""
|
|
[important-data]="NextCloud"
|
|
[emby]=""
|
|
)
|
|
|
|
declare -A PROFILE_CONTAINER_DELAY=(
|
|
[arrs_stack]=5
|
|
[critical-data]=10
|
|
[gmer4lfe]=5
|
|
[important-data]=10
|
|
[emby]=5
|
|
)
|
|
|
|
# SPACE-SEPARATED STRINGS
|
|
declare -A PROFILE_EXCLUDE_DIRS=(
|
|
[arrs_stack]="logs *.tmp"
|
|
[critical-data]="logs *.tmp"
|
|
[gmer4lfe]="logs *.tmp"
|
|
[important-data]="logs *.tmp"
|
|
[emby]="logs *.tmp"
|
|
)
|
|
#-----------------------------------------------------------------------------------------------
|
|
#---------------------- End Of User Variables, Please adjust above as needed -------------------
|
|
#----------------------------------------------------------------------------------------------- |