scheduler: add Array Starting / Array Stopping event triggers
Two hardcoded event-triggered entries appear at the top of the scheduler (array_started.sh / array_stopping.sh). They show an ⚡ Array Start / ⚡ Array Stop badge instead of a cron field and are enabled/disabled via the normal toggle. Static event scripts fire them via Unraid's event system: - event/disks_mounted/array_start_jobs → runs in background (non-blocking) - event/disks_unmounting/array_stop_jobs → runs foreground (blocks until done) vv_cron_rebuild() skips @array_* entries so they never land in the cron file. Scripts executed on each event are managed in master.conf via ARRAY_START_SCRIPTS and ARRAY_STOP_SCRIPTS arrays.
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Varaverk: run array_started.sh if enabled in the schedule (background — non-blocking).
|
||||
php -r "
|
||||
require_once '/usr/local/emhttp/plugins/varaverk/include/scheduler.php';
|
||||
\$s = vv_schedule_load();
|
||||
\$e = \$s['Orchestrators/array_started.sh'] ?? [];
|
||||
if (empty(\$e['enabled'])) exit(0);
|
||||
\$runner = '/usr/local/emhttp/plugins/varaverk/run_job.sh';
|
||||
\$script = SCRIPTS_DIR . '/Orchestrators/array_started.sh';
|
||||
if (!file_exists(\$script)) exit(0);
|
||||
\$flags = !empty(\$e['log_enabled']) ? ' --log' : '';
|
||||
exec('nohup bash ' . escapeshellarg(\$runner) . ' Orchestrators/array_started.sh ' . escapeshellarg(\$script) . \$flags . ' > /dev/null 2>&1 &');
|
||||
" 2>/dev/null
|
||||
Reference in New Issue
Block a user