Structure change and vissually fixing code to make it easier to read
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
# ----------------------- Common Helpers for Unraid Scripts -------------------------------------
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------- Output Helpers -----------------------------
|
||||
# Output Helpers
|
||||
info() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
@@ -20,8 +20,7 @@ log() {
|
||||
[[ "$ENABLE_LOGGING" == true ]] && echo "[LOG] $*"
|
||||
}
|
||||
|
||||
# ----------------------------- Argument Parsing -----------------------------
|
||||
parse_args() {
|
||||
# Argument Parsing
|
||||
DRY_RUN=${DRY_RUN:-false}
|
||||
ENABLE_LOGGING=${ENABLE_LOGGING:-false}
|
||||
|
||||
@@ -79,7 +78,7 @@ parse_args() {
|
||||
done
|
||||
}
|
||||
|
||||
# ----------------------------- Validation -----------------------------
|
||||
# Validation
|
||||
require_var() {
|
||||
local var="$1"
|
||||
if [[ -z "${!var:-}" ]]; then
|
||||
@@ -98,7 +97,7 @@ validate_int() {
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------- Host Detection -----------------------------
|
||||
# Host Detection
|
||||
detect_hosts() {
|
||||
LOCAL_HOSTNAME="$(hostname)"
|
||||
|
||||
@@ -129,7 +128,7 @@ detect_hosts() {
|
||||
log "SSH key: $SSH_KEY"
|
||||
}
|
||||
|
||||
# ----------------------------- Remote IP -----------------------------
|
||||
# Remote IP
|
||||
resolve_remote_ip() {
|
||||
log "Resolving Tailscale IP for $REMOTE_SERVER_NAME..."
|
||||
|
||||
@@ -143,13 +142,13 @@ resolve_remote_ip() {
|
||||
info "Remote IP: $REMOTE_SERVER"
|
||||
}
|
||||
|
||||
# ----------------------------- Connectivity -----------------------------
|
||||
# Connectivity
|
||||
check_remote_online() {
|
||||
log "Pinging $REMOTE_SERVER..."
|
||||
ping -c 1 "$REMOTE_SERVER" &>/dev/null
|
||||
}
|
||||
|
||||
# ----------------------------- Containers -----------------------------
|
||||
# Containers
|
||||
declare -a RUNNING_CONTAINERS=()
|
||||
|
||||
stop_containers() {
|
||||
@@ -196,7 +195,7 @@ start_containers() {
|
||||
done
|
||||
}
|
||||
|
||||
# ----------------------------- Rsync Options -----------------------------
|
||||
# Rsync Options
|
||||
get_rsync_opts() {
|
||||
if [[ -n "${PROFILE_RSYNC_OPTS[$PROFILE_NAME]:-}" ]]; then
|
||||
read -r -a RSYNC_OPTS <<< "${PROFILE_RSYNC_OPTS[$PROFILE_NAME]}"
|
||||
@@ -207,7 +206,7 @@ get_rsync_opts() {
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------- Status Output -----------------------------
|
||||
# Status Output
|
||||
show_status() {
|
||||
echo "===== RSYNC STATUS ====="
|
||||
echo "Local: $LOCAL_SERVER_NAME"
|
||||
|
||||
Reference in New Issue
Block a user