fix: remove all User Scripts dependencies — Varaverk plugin handles everything via event hooks, no User Scripts needed

This commit is contained in:
Gmer4Lfe
2026-06-01 19:57:21 -04:00
parent 98d2e6efa4
commit e0ae80d2ea
9 changed files with 65 additions and 75 deletions
+3 -3
View File
@@ -591,9 +591,9 @@ errors are always visible regardless of `--log`.
### fallback.sh ### fallback.sh
`fallback.sh` `fallback.sh`
Normal start — continuous loop. Start via User Scripts plugin or array_started.sh. **Do NOT Normal start — continuous loop. Started automatically by `array_started.sh` at array start.
stop by killing the process** — state file may be left inconsistent. Stop via User Scripts **Do NOT stop by killing the process** — state file may be left inconsistent. Stop via
Abort only. `fallback.sh --stop` only.
`fallback.sh --dry-run` `fallback.sh --dry-run`
Walk through one full cycle showing what would happen based on current network state. No Walk through one full cycle showing what would happen based on current network state. No
+1 -2
View File
@@ -219,8 +219,7 @@
# fallback.sh --log # fallback.sh --log
# Verbose output on every decision in every cycle. # Verbose output on every decision in every cycle.
# #
# To stop: use `fallback.sh --stop` or click Abort in User Scripts. # To stop: use `fallback.sh --stop`. Do NOT kill -9 — state file may corrupt if mid-write.
# Do NOT kill -9 directly — state file may corrupt if mid-write.
# #
# ============================================================================================== # ==============================================================================================
+15 -25
View File
@@ -30,7 +30,6 @@ Install these via **Apps** (Community Applications) on both servers:
| Plugin | Why | | Plugin | Why |
|--------|-----| |--------|-----|
| **Tailscale** | Encrypted VPN between servers — all script traffic travels over it | | **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 ━━━ ## ━━━ STEP 5: SCHEDULER SETUP ━━━
**Array start** uses the User Scripts plugin (one entry only). **Everything else** runs **Everything runs through the Varaverk plugin's built-in scheduler** — no User Scripts
through the Varaverk plugin's built-in scheduler — configure via the Scheduler tab or entries needed. The plugin handles all triggers natively:
`schedule.json`. Individual scripts are never scheduled directly.
- **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 | Event/Cron | Purpose |
|--------|-----------|---------|
| Script | Schedule | Command | | `array_started` | `array_start` | All array startup scripts in order |
|--------|----------|---------| | `array_stopping` | `array_stop` | Ordered graceful shutdown |
| `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 |
|--------|------|---------|
| `transcode_management` | `*/7 * * * *` | Cleanup then manager — order critical | | `transcode_management` | `*/7 * * * *` | Cleanup then manager — order critical |
| `watchdog_orchestrator` | `*/15 * * * *` | resource → docker → system → stability | | `watchdog_orchestrator` | `*/15 * * * *` | resource → docker → system → stability |
| `critical_sync_maintenance` | `*/30 * * * *` | auth + Emby dirty sync + partnership | | `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 | | `weekly_sync_maintenance` | `30 2 * * 0` | clean sync + image updates |
| `monthly_maintenance` | `0 0 15 * *` | ZFS scrub, SMART tests (uptime-gated) | | `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 Concurrent runs are prevented by `acquire_lock`. For the complete schedule see
the new one exits immediately. No need to stagger entries manually.
For the complete schedule and what each orchestrator runs, see
[README-Orchestrators.md](Orchestrators/README-Orchestrators.md). [README-Orchestrators.md](Orchestrators/README-Orchestrators.md).
--- ---
+24 -24
View File
@@ -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`. 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. Adding or removing a job never requires touching the orchestrator script itself.
> **The User Scripts plugin contains only orchestrators.** Every cron entry, every > **The Varaverk scheduler runs only orchestrators.** Every cron entry, every array
> "At Startup of Array" entry, every scheduled operation runs through an orchestrator. > start/stop event, every scheduled operation runs through an orchestrator. The individual
> The individual scripts it calls are never scheduled directly — they run in a defined > scripts it calls are never scheduled directly — they run in a defined order inside a
> order inside a coordinated window, with a unified summary at the end. > 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 ### 🔴 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 Startup scripts configured individually ran in an unpredictable order. The ramdisk
unpredictable order. The ramdisk setup might run after Emby starts. The syslog setup might run after Emby starts. The syslog filter might run after containers have
filter might run after containers have already created veth interfaces. PHP-FPM already created veth interfaces. PHP-FPM tuning might run after the WebGUI has already
tuning might run after the WebGUI has already served its first requests. Each served its first requests. Each script competed for the same startup slot with no
script competes for the same startup slot with no guaranteed order. guaranteed order.
The fix: `array_started.sh` is the only "At Startup of Array" entry. It launches The fix: `array_started.sh` is the only array-start entry in the Varaverk scheduler.
every startup script in a defined order, with one-second settle between each, and It launches every startup script in a defined order, with one-second settle between
reports which succeeded and which failed. Order is guaranteed. Nothing starts before each, and reports which succeeded and which failed. Order is guaranteed. Nothing starts
its dependency. Everything is visible in a single summary. before its dependency. Everything is visible in a single summary.
--- ---
## ━━━ THE ORCHESTRATOR MODEL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ## ━━━ THE ORCHESTRATOR MODEL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The Varaverk scheduler (and User Scripts for array start) contains exactly these entries: The Varaverk scheduler contains exactly these entries:
```bash ```bash
# At Startup of Array — single entry for all startup scripts: # Array start event (Varaverk disks_mounted hook → cron: "array_start"):
array_started.sh array_started.sh
# Cron — one entry per maintenance window: # Cron — managed via Varaverk Scheduler:
*/7 * * * * transcode_management.sh */7 * * * * transcode_management.sh
*/15 * * * * watchdog_orchestrator.sh ← resource → docker → system → stability */15 * * * * watchdog_orchestrator.sh ← resource → docker → system → stability
*/30 * * * * critical_sync_maintenance.sh ← auth + Emby dirty sync + partnership */30 * * * * critical_sync_maintenance.sh ← auth + Emby dirty sync + partnership
@@ -169,7 +169,7 @@ without `--log`.
| Script | What It Orchestrates | Schedule | | 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 | | `watchdog_orchestrator.sh` | resource → docker → system → api_renew → stability watchdogs | Every 15 minutes |
| `transcode_management.sh` | Cleanup then manager — order critical | Every 7 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 | | `arrs_failed_stalled_recovery.sh` | Failed import + stalled download recovery | Every 6 hours |
@@ -184,13 +184,13 @@ without `--log`.
## 🚀 array_started.sh ## 🚀 array_started.sh
## ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ## ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Single "At Startup of Array" entry for the entire ecosystem. Launches every startup Single array-start entry for the entire ecosystem. Fired by the Varaverk plugin's
script in order — each as a background process — and reports which succeeded and which `disks_mounted` event hook. Launches every startup script in order — each as a
failed. You never need to add individual scripts to the User Scripts startup list. background process — and reports which succeeded and which failed.
```bash ```bash
# Scheduled: At Startup of Array (User Scripts plugin) # Triggered by: Plugin/unraid/event/disks_mounted/array_start_jobs
# This is the ONLY "At Startup of Array" entry in User Scripts # schedule.json entry: "Orchestrators/array_started.sh" → cron: "array_start"
``` ```
--- ---
@@ -266,7 +266,7 @@ ARRAY_START_SCRIPTS=(
```bash ```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 # array_started.sh runs once and exits — the continuous scripts it launched
# keep running as background processes. # keep running as background processes.
# ───────────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────────
@@ -888,7 +888,7 @@ monthly_maintenance.sh --log # verbose output from each child script
```bash ```bash
# ───────────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────────
# At Startup of Array — single entry: # Array start event (Varaverk disks_mounted hook):
# ───────────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────────
array_started.sh array_started.sh
+4 -3
View File
@@ -2,9 +2,10 @@
# ============================================================================================== # ==============================================================================================
# ================================= Array Start Orchestrator =================================== # ================================= 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. # 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 ────────────────────────────────────────────────────────────────────────── # ── WHAT IT LAUNCHES ──────────────────────────────────────────────────────────────────────────
# Configured in master.conf ARRAY_START_SCRIPTS — no changes to this script ever needed. # 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 # ARRAY_START_SCRIPTS — ordered list of scripts to launch at array start
# #
# ── USAGE ───────────────────────────────────────────────────────────────────────────────────── # ── 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 --dry-run — show what would be launched without launching
# array_started.sh --status — show configured scripts and their current state # array_started.sh --status — show configured scripts and their current state
# array_started.sh --log — verbose output per script # array_started.sh --log — verbose output per script
+7 -6
View File
@@ -2,14 +2,15 @@
# 📋 USER SCRIPTS PLUGIN — COMPLETE SETUP REFERENCE # 📋 USER SCRIPTS PLUGIN — COMPLETE SETUP REFERENCE
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> **Mostly superseded.** Scheduling has moved to the Varaverk plugin's built-in > **Fully superseded.** The Varaverk plugin handles all scheduling natively — no User
> scheduler. Only `array_started.sh` still uses User Scripts (for the "At Startup of Array" > Scripts entries are needed. Array start and stop are triggered by the plugin's own
> hook). All cron entries are now managed via the Varaverk Scheduler tab or `schedule.json`. > `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. > See `Orchestrators/README-Orchestrators.md` for the current complete schedule.
**Historical reference for the User Scripts plugin setup — what each script does, **Historical reference** — documents what each script does and how it was previously
when it ran, how it was configured.** Still useful as a script reference. Paths configured via User Scripts. Still useful as a script catalogue. Paths updated to
updated to reflect current boot-drive installation location. reflect current boot-drive installation location.
--- ---
+3 -3
View File
@@ -554,7 +554,7 @@ varaverk/
## ━━━ WHAT RUNS WHEN ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ## ━━━ 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: At Startup of Array:
@@ -813,9 +813,9 @@ Things that are different from what you might expect:
```bash ```bash
# ───────────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────────
# 1. Arbiter has very few entries. # 1. The Varaverk scheduler has very few entries.
# Everything runs through orchestrators. Individual scripts are never # 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. # 2. Scripts are silent when healthy.
# stability_watchdog.sh runs 288 times per day. It produces zero output on clean # stability_watchdog.sh runs 288 times per day. It produces zero output on clean
+7 -8
View File
@@ -425,16 +425,15 @@ HOST1_PERSONAL_SHARES=(
## ━━━ STEP 7 — SCHEDULER SETUP ━━━ ## ━━━ STEP 7 — SCHEDULER SETUP ━━━
Schedules are managed by the Varaverk plugin scheduler (not User Scripts). All scheduling is managed by the Varaverk plugin no User Scripts entries needed.
Array start is still configured in User Scripts as a single entry.
### At Startup of Array (User Scripts — single entry) ### Array start (Varaverk disks_mounted event hook)
```bash The Varaverk plugin fires `array_started.sh` automatically via its `disks_mounted` event
#!/bin/bash hook. It's registered in `schedule.json`:
bash /boot/config/plugins/varaverk/Orchestrators/array_started.sh
# Schedule: At Startup of Array ```json
# Run as: Background Task "Orchestrators/array_started.sh": { "cron": "array_start", "enabled": true }
``` ```
Launches everything in ARRAY_START_SCRIPTS: api_key_renew, inotify_tuning, Launches everything in ARRAY_START_SCRIPTS: api_key_renew, inotify_tuning,
+1 -1
View File
@@ -401,7 +401,7 @@ TRANSCODE_SERVERS=(
## Schedule ## 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 ramdisk_setup.sh — creates ramdisk, symlink, transcoding-temp
Must run BEFORE Emby starts Must run BEFORE Emby starts