Platform adapter: rename System_Essentials, add Plugin/unraid/adapter.sh, wire call sites
- Rename unRAID_Essentials/ → System_Essentials/ (git detects as rename) - Add Plugin/unraid/adapter.sh: 13 platform_*() functions providing OS-agnostic API for storage health, service management, mover, user scripts, notifications, disk temps, and platform command validation - Update load_config.sh: detect PLATFORM (unraid/truenas/unknown), export SCRIPTS_DIR, auto-source Plugin/$PLATFORM/adapter.sh after common.sh - Wire all call sites: replace direct rc.d, pgrep/pkill, var.ini, dynamix.cfg, disks.ini, and validate_unraid_cmd calls with platform_*() functions across watchdogs, orchestrators, and System_Essentials scripts - Update all documentation: rename refs, update webgui escalation logic, add platform adapter section to Plugin README, update main README with portability vision and corrected self-healing stack description
This commit is contained in:
@@ -119,7 +119,7 @@ if [[ "$EUID" -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
validate_unraid_cmd \
|
||||
platform_require_cmd \
|
||||
"/usr/local/emhttp/plugins/dynamix/scripts/notify" \
|
||||
"" "" \
|
||||
"unRAID notify script" || warn "unRAID notify script not found — native notifications disabled"
|
||||
@@ -302,12 +302,8 @@ check_abort_conditions() {
|
||||
fi
|
||||
fi
|
||||
|
||||
# Unraid 7.3+: parity state is in var.ini (mdResync != 0 means check/sync in progress)
|
||||
# Older: parity-date.txt contained "progress" — check both for compatibility
|
||||
_md_resync=$(awk -F'"' '/^mdResync=/{print $2}' /var/local/emhttp/var.ini 2>/dev/null)
|
||||
_parity_running=false
|
||||
[[ -n "$_md_resync" && "$_md_resync" != "0" ]] && _parity_running=true
|
||||
grep -q "progress" /var/local/emhttp/parity-date.txt 2>/dev/null && _parity_running=true
|
||||
platform_is_maintenance_running && _parity_running=true
|
||||
if [[ "$_parity_running" == true ]]; then
|
||||
if [[ "$SYS_WATCHDOG_ABORT_ON_PARITY" == true ]]; then
|
||||
error "Parity check running — aborting reboot"
|
||||
@@ -451,7 +447,7 @@ do_reboot() {
|
||||
fi
|
||||
|
||||
warn "Stopping User Scripts..."
|
||||
pkill -f "/tmp/user.scripts" 2>/dev/null || true
|
||||
platform_stop_user_scripts
|
||||
|
||||
warn "Syncing disks..."
|
||||
sync
|
||||
@@ -726,12 +722,12 @@ echo "━━━ $ICON_REBOOT Stability Watchdog — $(date '+%Y-%m-%d %H:%M:%S')
|
||||
|
||||
# ── sshd — try restart before escalating ─────────────────────────────────────────────────
|
||||
if [[ "$SYS_WATCHDOG_CHECK_SSHD" == true ]]; then
|
||||
if ! pgrep -x sshd >/dev/null 2>&1; then
|
||||
if ! platform_is_service_running sshd; then
|
||||
warn "sshd not running — attempting restart..."
|
||||
if [[ "$DRY_RUN" == false ]]; then
|
||||
/etc/rc.d/rc.sshd start >/dev/null 2>&1
|
||||
platform_restart_service sshd
|
||||
sleep 3
|
||||
if pgrep -x sshd >/dev/null 2>&1; then
|
||||
if platform_is_service_running sshd; then
|
||||
warn "sshd restarted successfully ✅"
|
||||
reset_strikes "sshd"
|
||||
notify "sshd was down on $(hostname) ($MY_ID) — restarted automatically" \
|
||||
|
||||
Reference in New Issue
Block a user