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`
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
+1 -2
View File
@@ -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.
#
# ==============================================================================================
+15 -25
View File
@@ -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).
---
+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`.
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
+4 -3
View File
@@ -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
+7 -6
View File
@@ -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.
---
+3 -3
View File
@@ -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
+7 -8
View File
@@ -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,
+1 -1
View File
@@ -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