diff --git a/Master.conf b/Master.conf index d319317..6713532 100644 --- a/Master.conf +++ b/Master.conf @@ -2,16 +2,19 @@ #----------------------------------------------------------------------------------------------- #----------------------------- Master Variables for unRAID scripts ----------------------------- #----------------------------------------------------------------------------------------------- +# This is the master.conf file, it contains all the variables used by +# all scripts. +# +# It is sourced by each script at runtime, so any changes here will +# affect all scripts immediately. +# +# This is where you should adjust any settings or variables +# that you want to apply globally across all your scripts +# +#----------------------------------------------------------------------------------------------- #----------------- User Variables, Please adjust here in Master.conf as needed ----------------- #----------------------------------------------------------------------------------------------- -# This is the master.conf file, it contains all the variables used by -# all scripts. It is sourced by each script at runtime, so any changes here will -# affect all scripts immediately. This is where you should adjust any settings or variables -# that you want to apply globally across all your scripts -# -#This allows for one centralized location for all your configurations, making it easier to manage -# and maintain your scripts. You can adjust the variables below as needed. -# + #-------------------- Host Configuration -------------------- # List the Hostnames of both servers HOST1="unRAID-Gmer4Lfe" @@ -51,11 +54,41 @@ PHP_CONF="/etc/php-fpm.d/www.conf" # php_fpm_max_children.sh max children value PHP_MAX_CHILDREN=250 -# Profiles -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) +#---------------------- Profile System ------------------------- +# Profiles are inferred from the directory basename (lowercased) +# Max rsync processes per profile +declare -A PROFILE_MAX_PROCS=( + [arrs_stack]=2 + [critical-data]=2 + [gmer4lfe]=1 + [important-data]=2 + [emby]=1 +) +# Bandwidth limits per profile (KB/s, 0 = unlimited) +declare -A PROFILE_BW_LIMIT=( + [arrs_stack]=5000 + [critical-data]=9500 + [gmer4lfe]=8000 + [important-data]=9500 + [emby]=8000 +) +# Retry logic per profile +declare -A PROFILE_RETRY_COUNT=( + [arrs_stack]=3 + [critical-data]=3 + [gmer4lfe]=3 + [important-data]=3 + [emby]=3 +) +# Sleep between retries per profile (seconds) +declare -A PROFILE_SLEEP=( + [arrs_stack]=300 + [critical-data]=300 + [gmer4lfe]=300 + [important-data]=300 + [emby]=300 +) +# Containers to stop/start per profile (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" @@ -63,6 +96,30 @@ declare -A PROFILE_CRITICAL_CONTAINER_NAMES=( [important-data]="Postgres-NextCloud NextCloud" [emby]="" ) -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) -declare -A PROFILE_EXCLUDE_DIRS=([arrs_stack]="logs *.tmp" [critical-data]="logs *.tmp" [gmer4lfe]="logs *.tmp" [important-data]="logs *.tmp" [emby]="logs *.tmp") \ No newline at end of file +# Delayed containers per profile (space-separated strings) +declare -A PROFILE_DELAYED_CONTAINERS=( + [arrs_stack]="" + [critical-data]="Authelia" + [gmer4lfe]="" + [important-data]="NextCloud" + [emby]="" +) +# Delay in seconds before starting delayed containers per profile (seconds) +declare -A PROFILE_CONTAINER_DELAY=( + [arrs_stack]=5 + [critical-data]=10 + [gmer4lfe]=5 + [important-data]=10 + [emby]=5 +) +# Not include logs or other file types during transfer per profile +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 ------------------- +#----------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Rsync/rsync.sh b/Rsync/rsync.sh index 56cc10c..1e59e44 100644 --- a/Rsync/rsync.sh +++ b/Rsync/rsync.sh @@ -1,6 +1,26 @@ #!/bin/bash set -e +#----------------------------------------------------------------------------------------------- +#----------------- User Variables, Please adjust here in Master.conf as needed ----------------- +#----------------------------------------------------------------------------------------------- +## This is the main Core Rsync script +# +# User variables can be adjusted in Master.conf +# Scripts now just contain runtime logic +# +# This allows for profiles and multiple things to use the core script +# Use arguments in unRAID User Plugin for directory +# Example: /mnt/user/appdata/unraid_scripts/Rsync/rsync.sh /mnt/user/appdata-test/Arrs/ +# +# /mnt/user/appdata-test/Arrs/ is the argument +# If the last name /Arrs/ matches a profile in Master.conf, then profile defaults are used +# Otherwise, global configuration in Master.conf is used +#----------------------------------------------------------------------------------------------- +#----------------- User Variables, Please adjust here in Master.conf as needed ----------------- +#----------------------------------------------------------------------------------------------- +# + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Load config & helpers diff --git a/common.sh b/common.sh index 20d6bcd..4ffea60 100644 --- a/common.sh +++ b/common.sh @@ -1,9 +1,9 @@ #!/bin/bash #----------------------------------------------------------------------------------------------- #----------------------------- Common helpers for unRAID scripts ------------------------------- -# Requires Master.conf to be sourced first #----------------------------------------------------------------------------------------------- +# Requires Master.conf to be sourced first # ----------------------------- Helpers ----------------------------- parse_args() { for ARG in "$@"; do