From e0ae80d2ea774fb5d7601ad803acd0d67b483e33 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Mon, 1 Jun 2026 19:57:21 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20remove=20all=20User=20Scripts=20dependen?= =?UTF-8?q?cies=20=E2=80=94=20Varaverk=20plugin=20handles=20everything=20v?= =?UTF-8?q?ia=20event=20hooks,=20no=20User=20Scripts=20needed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Fallback/Manual-Fallback.md | 6 ++-- Fallback/fallback.sh | 3 +- Manual.md | 40 +++++++++------------- Orchestrators/README-Orchestrators.md | 48 +++++++++++++-------------- Orchestrators/array_started.sh | 7 ++-- README-User_Script_Plug-in.md | 13 ++++---- README.md | 6 ++-- Rsync/Manual-Rsync.md | 15 ++++----- Transcodes/Manual-Transcoding.md | 2 +- 9 files changed, 65 insertions(+), 75 deletions(-) diff --git a/Fallback/Manual-Fallback.md b/Fallback/Manual-Fallback.md index 973bdb6..0c98791 100644 --- a/Fallback/Manual-Fallback.md +++ b/Fallback/Manual-Fallback.md @@ -591,9 +591,9 @@ errors are always visible regardless of `--log`. ### fallback.sh `fallback.sh` -Normal start — continuous loop. Start via User Scripts plugin or array_started.sh. **Do NOT -stop by killing the process** — state file may be left inconsistent. Stop via User Scripts -Abort only. +Normal start — continuous loop. Started automatically by `array_started.sh` at array start. +**Do NOT stop by killing the process** — state file may be left inconsistent. Stop via +`fallback.sh --stop` only. `fallback.sh --dry-run` Walk through one full cycle showing what would happen based on current network state. No diff --git a/Fallback/fallback.sh b/Fallback/fallback.sh index 5890065..49796d1 100755 --- a/Fallback/fallback.sh +++ b/Fallback/fallback.sh @@ -219,8 +219,7 @@ # fallback.sh --log # Verbose output on every decision in every cycle. # -# To stop: use `fallback.sh --stop` or click Abort in User Scripts. -# Do NOT kill -9 directly — state file may corrupt if mid-write. +# To stop: use `fallback.sh --stop`. Do NOT kill -9 — state file may corrupt if mid-write. # # ============================================================================================== diff --git a/Manual.md b/Manual.md index c4f96c2..f17e91d 100644 --- a/Manual.md +++ b/Manual.md @@ -30,7 +30,6 @@ Install these via **Apps** (Community Applications) on both servers: | Plugin | Why | |--------|-----| | **Tailscale** | Encrypted VPN between servers — all script traffic travels over it | -| **User Scripts** | Required for "At Startup of Array" hook — array_started.sh entry only | --- @@ -298,30 +297,24 @@ ssh -o StrictHostKeyChecking=accept-new root@unRAID-Gmer4Lfe "echo ok" ## ━━━ STEP 5: SCHEDULER SETUP ━━━ -**Array start** uses the User Scripts plugin (one entry only). **Everything else** runs -through the Varaverk plugin's built-in scheduler — configure via the Scheduler tab or -`schedule.json`. Individual scripts are never scheduled directly. +**Everything runs through the Varaverk plugin's built-in scheduler** — no User Scripts +entries needed. The plugin handles all triggers natively: + +- **Array start** → `Plugin/unraid/event/disks_mounted/array_start_jobs` fires `array_started.sh` +- **Array stop** → `Plugin/unraid/event/disks_unmounting/array_stop_jobs` fires `array_stopping.sh` +- **Cron** → `Plugin/unraid/event/disks_mounted/rebuild_cron` rebuilds the cron file from `schedule.json` on every boot + +Configure via the Varaverk plugin Scheduler tab (or edit `schedule.json` directly). +Individual scripts are never scheduled — only orchestrators. --- -### ── User Scripts — array start only ───────────────────────────────────────── +### ── Schedule (Varaverk Scheduler) ─────────────────────────────────────────── -Open **Settings → User Scripts**. Create one entry: - -| Script | Schedule | Command | -|--------|----------|---------| -| `array_started` | At Array Start | `bash /boot/config/plugins/varaverk/Orchestrators/array_started.sh` | - -Set to **Background Task**. This launches everything in ARRAY_START_SCRIPTS. - ---- - -### ── Varaverk Scheduler — all cron entries ──────────────────────────────────── - -Configure via the Varaverk plugin Scheduler tab (or edit `schedule.json` directly): - -| Script | Cron | Purpose | -|--------|------|---------| +| Script | Event/Cron | Purpose | +|--------|-----------|---------| +| `array_started` | `array_start` | All array startup scripts in order | +| `array_stopping` | `array_stop` | Ordered graceful shutdown | | `transcode_management` | `*/7 * * * *` | Cleanup then manager — order critical | | `watchdog_orchestrator` | `*/15 * * * *` | resource → docker → system → stability | | `critical_sync_maintenance` | `*/30 * * * *` | auth + Emby dirty sync + partnership | @@ -330,10 +323,7 @@ Configure via the Varaverk plugin Scheduler tab (or edit `schedule.json` directl | `weekly_sync_maintenance` | `30 2 * * 0` | clean sync + image updates | | `monthly_maintenance` | `0 0 15 * *` | ZFS scrub, SMART tests (uptime-gated) | -Concurrent runs are prevented by `acquire_lock` — if the previous run is still active -the new one exits immediately. No need to stagger entries manually. - -For the complete schedule and what each orchestrator runs, see +Concurrent runs are prevented by `acquire_lock`. For the complete schedule see [README-Orchestrators.md](Orchestrators/README-Orchestrators.md). --- diff --git a/Orchestrators/README-Orchestrators.md b/Orchestrators/README-Orchestrators.md index 92da945..289a904 100644 --- a/Orchestrators/README-Orchestrators.md +++ b/Orchestrators/README-Orchestrators.md @@ -7,10 +7,10 @@ Orchestrators contain no business logic — they call other scripts in order, tr pass/fail per job, and produce one clean summary. Configuration lives in `master.conf`. Adding or removing a job never requires touching the orchestrator script itself. -> **The User Scripts plugin contains only orchestrators.** Every cron entry, every -> "At Startup of Array" entry, every scheduled operation runs through an orchestrator. -> The individual scripts it calls are never scheduled directly — they run in a defined -> order inside a coordinated window, with a unified summary at the end. +> **The Varaverk scheduler runs only orchestrators.** Every cron entry, every array +> start/stop event, every scheduled operation runs through an orchestrator. The individual +> scripts it calls are never scheduled directly — they run in a defined order inside a +> coordinated window, with a unified summary at the end. --- @@ -80,28 +80,28 @@ import has already been replaced by a working one. No manual intervention requir ### 🔴 Array Start Scripts Running in Wrong Order or Not at All -Scripts configured in the User Scripts plugin as "At Startup of Array" run in an -unpredictable order. The ramdisk setup might run after Emby starts. The syslog -filter might run after containers have already created veth interfaces. PHP-FPM -tuning might run after the WebGUI has already served its first requests. Each -script competes for the same startup slot with no guaranteed order. +Startup scripts configured individually ran in an unpredictable order. The ramdisk +setup might run after Emby starts. The syslog filter might run after containers have +already created veth interfaces. PHP-FPM tuning might run after the WebGUI has already +served its first requests. Each script competed for the same startup slot with no +guaranteed order. -The fix: `array_started.sh` is the only "At Startup of Array" entry. It launches -every startup script in a defined order, with one-second settle between each, and -reports which succeeded and which failed. Order is guaranteed. Nothing starts before -its dependency. Everything is visible in a single summary. +The fix: `array_started.sh` is the only array-start entry in the Varaverk scheduler. +It launches every startup script in a defined order, with one-second settle between +each, and reports which succeeded and which failed. Order is guaranteed. Nothing starts +before its dependency. Everything is visible in a single summary. --- ## ━━━ THE ORCHESTRATOR MODEL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -The Varaverk scheduler (and User Scripts for array start) contains exactly these entries: +The Varaverk scheduler contains exactly these entries: ```bash -# At Startup of Array — single entry for all startup scripts: +# Array start event (Varaverk disks_mounted hook → cron: "array_start"): array_started.sh -# Cron — one entry per maintenance window: +# Cron — managed via Varaverk Scheduler: */7 * * * * transcode_management.sh */15 * * * * watchdog_orchestrator.sh ← resource → docker → system → stability */30 * * * * critical_sync_maintenance.sh ← auth + Emby dirty sync + partnership @@ -169,7 +169,7 @@ without `--log`. | Script | What It Orchestrates | Schedule | |--------|---------------------|----------| -| `array_started.sh` | All array startup scripts in order | At Startup of Array | +| `array_started.sh` | All array startup scripts in order | `array_start` event (Varaverk plugin hook) | | `watchdog_orchestrator.sh` | resource → docker → system → api_renew → stability watchdogs | Every 15 minutes | | `transcode_management.sh` | Cleanup then manager — order critical | Every 7 minutes | | `arrs_failed_stalled_recovery.sh` | Failed import + stalled download recovery | Every 6 hours | @@ -184,13 +184,13 @@ without `--log`. ## 🚀 array_started.sh ## ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Single "At Startup of Array" entry for the entire ecosystem. Launches every startup -script in order — each as a background process — and reports which succeeded and which -failed. You never need to add individual scripts to the User Scripts startup list. +Single array-start entry for the entire ecosystem. Fired by the Varaverk plugin's +`disks_mounted` event hook. Launches every startup script in order — each as a +background process — and reports which succeeded and which failed. ```bash -# Scheduled: At Startup of Array (User Scripts plugin) -# This is the ONLY "At Startup of Array" entry in User Scripts +# Triggered by: Plugin/unraid/event/disks_mounted/array_start_jobs +# schedule.json entry: "Orchestrators/array_started.sh" → cron: "array_start" ``` --- @@ -266,7 +266,7 @@ ARRAY_START_SCRIPTS=( ```bash # ───────────────────────────────────────────────────────────────────────────── -# Normal — called by User Scripts at array start. Never run manually in production. +# Normal — fired by Varaverk disks_mounted event hook. Never run manually in production. # array_started.sh runs once and exits — the continuous scripts it launched # keep running as background processes. # ───────────────────────────────────────────────────────────────────────────── @@ -888,7 +888,7 @@ monthly_maintenance.sh --log # verbose output from each child script ```bash # ───────────────────────────────────────────────────────────────────────────── -# At Startup of Array — single entry: +# Array start event (Varaverk disks_mounted hook): # ───────────────────────────────────────────────────────────────────────────── array_started.sh diff --git a/Orchestrators/array_started.sh b/Orchestrators/array_started.sh index 3554251..79432c9 100755 --- a/Orchestrators/array_started.sh +++ b/Orchestrators/array_started.sh @@ -2,9 +2,10 @@ # ============================================================================================== # ================================= Array Start Orchestrator =================================== # ============================================================================================== -# Single entry point for "At Startup of Array" in the User Scripts plugin. +# Single entry point for array start — fired by the Varaverk plugin's +# disks_mounted event hook (Plugin/unraid/event/disks_mounted/array_start_jobs). # Launches everything configured in ARRAY_START_SCRIPTS in master.conf. -# This script exits after launching all scripts — unRAID sees it complete normally. +# This script exits after launching all scripts — the event hook sees it complete normally. # # ── WHAT IT LAUNCHES ────────────────────────────────────────────────────────────────────────── # Configured in master.conf ARRAY_START_SCRIPTS — no changes to this script ever needed. @@ -52,7 +53,7 @@ # ARRAY_START_SCRIPTS — ordered list of scripts to launch at array start # # ── USAGE ───────────────────────────────────────────────────────────────────────────────────── -# array_started.sh — normal launch (called by User Scripts at array start) +# array_started.sh — normal launch (called by Varaverk disks_mounted event hook) # array_started.sh --dry-run — show what would be launched without launching # array_started.sh --status — show configured scripts and their current state # array_started.sh --log — verbose output per script diff --git a/README-User_Script_Plug-in.md b/README-User_Script_Plug-in.md index f074096..1e50383 100644 --- a/README-User_Script_Plug-in.md +++ b/README-User_Script_Plug-in.md @@ -2,14 +2,15 @@ # 📋 USER SCRIPTS PLUGIN — COMPLETE SETUP REFERENCE # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -> **Mostly superseded.** Scheduling has moved to the Varaverk plugin's built-in -> scheduler. Only `array_started.sh` still uses User Scripts (for the "At Startup of Array" -> hook). All cron entries are now managed via the Varaverk Scheduler tab or `schedule.json`. +> **Fully superseded.** The Varaverk plugin handles all scheduling natively — no User +> Scripts entries are needed. Array start and stop are triggered by the plugin's own +> `disks_mounted` / `disks_unmounting` event hooks. Cron is managed via `schedule.json` +> and rebuilt on every boot. User Scripts is not required. > See `Orchestrators/README-Orchestrators.md` for the current complete schedule. -**Historical reference for the User Scripts plugin setup — what each script does, -when it ran, how it was configured.** Still useful as a script reference. Paths -updated to reflect current boot-drive installation location. +**Historical reference** — documents what each script does and how it was previously +configured via User Scripts. Still useful as a script catalogue. Paths updated to +reflect current boot-drive installation location. --- diff --git a/README.md b/README.md index c6cb93b..a4e57d6 100644 --- a/README.md +++ b/README.md @@ -554,7 +554,7 @@ varaverk/ ## ━━━ WHAT RUNS WHEN ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -Arbiter runs only orchestrators — never individual scripts directly. +The Varaverk scheduler runs only orchestrators — never individual scripts directly. ``` At Startup of Array: @@ -813,9 +813,9 @@ Things that are different from what you might expect: ```bash # ───────────────────────────────────────────────────────────────────────────── -# 1. Arbiter has very few entries. +# 1. The Varaverk scheduler has very few entries. # Everything runs through orchestrators. Individual scripts are never -# scheduled directly. array_started.sh is the only "At Startup of Array" entry. +# scheduled directly. array_started.sh is the only array_start event entry. # 2. Scripts are silent when healthy. # stability_watchdog.sh runs 288 times per day. It produces zero output on clean diff --git a/Rsync/Manual-Rsync.md b/Rsync/Manual-Rsync.md index 080b9ad..c208e3e 100644 --- a/Rsync/Manual-Rsync.md +++ b/Rsync/Manual-Rsync.md @@ -425,16 +425,15 @@ HOST1_PERSONAL_SHARES=( ## ━━━ STEP 7 — SCHEDULER SETUP ━━━ -Schedules are managed by the Varaverk plugin scheduler (not User Scripts). -Array start is still configured in User Scripts as a single entry. +All scheduling is managed by the Varaverk plugin — no User Scripts entries needed. -### At Startup of Array (User Scripts — single entry) +### Array start (Varaverk disks_mounted event hook) -```bash -#!/bin/bash -bash /boot/config/plugins/varaverk/Orchestrators/array_started.sh -# Schedule: At Startup of Array -# Run as: Background Task +The Varaverk plugin fires `array_started.sh` automatically via its `disks_mounted` event +hook. It's registered in `schedule.json`: + +```json +"Orchestrators/array_started.sh": { "cron": "array_start", "enabled": true } ``` Launches everything in ARRAY_START_SCRIPTS: api_key_renew, inotify_tuning, diff --git a/Transcodes/Manual-Transcoding.md b/Transcodes/Manual-Transcoding.md index a0a040d..e74cfce 100644 --- a/Transcodes/Manual-Transcoding.md +++ b/Transcodes/Manual-Transcoding.md @@ -401,7 +401,7 @@ TRANSCODE_SERVERS=( ## Schedule ``` -At Startup of Array (via array_started.sh in unRAID_Essentials/): +At array start (via array_started.sh in Orchestrators/): ramdisk_setup.sh — creates ramdisk, symlink, transcoding-temp Must run BEFORE Emby starts