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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user