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:
Gmer4Lfe
2026-05-24 21:54:13 -04:00
parent 1540c62d3a
commit 655c520ae8
6 changed files with 126 additions and 24 deletions
@@ -12,8 +12,9 @@ if (!$id) {
exit;
}
// Basic cron validation — 5 fields or empty
if ($cron && !preg_match('/^(\S+\s+){4}\S+$/', $cron)) {
// Basic cron validation — 5 fields, or known @event trigger, or empty
if ($cron && !in_array($cron, ['@array_start', '@array_stop'], true)
&& !preg_match('/^(\S+\s+){4}\S+$/', $cron)) {
echo json_encode(['ok' => false, 'error' => 'Invalid cron expression']);
exit;
}