From 7c14627bc35f5f9db713a7d68be83cdf73934df7 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Sun, 24 May 2026 18:46:45 -0400 Subject: [PATCH] feat(scheduler): live running indicators for cron-triggered jobs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add api/status.php — reads all scheduled jobs' stat files and returns a {id: status} map. The scheduler page polls it every 3s and lights up the dot on any job whose stat shows status=running, clearing it when done. Replace single vvRunningId with vvRunningSet (Set) so multiple jobs can show as running simultaneously. vvSetDot/vvClearDot handle per-job dots and the header dot for the active job. Remove stale-count detection from vvFetchRight — status poll is now the single source of truth. --- .../emhttp/plugins/varaverk/api/status.php | 19 ++++ .../plugins/varaverk/pages/scheduler.php | 88 +++++++++++-------- 2 files changed, 68 insertions(+), 39 deletions(-) create mode 100644 Plugin/usr/local/emhttp/plugins/varaverk/api/status.php diff --git a/Plugin/usr/local/emhttp/plugins/varaverk/api/status.php b/Plugin/usr/local/emhttp/plugins/varaverk/api/status.php new file mode 100644 index 0000000..7747530 --- /dev/null +++ b/Plugin/usr/local/emhttp/plugins/varaverk/api/status.php @@ -0,0 +1,19 @@ + $entry) { + $statFile = vv_job_stat_path($id); + if (!file_exists($statFile)) continue; + $stat = json_decode(@file_get_contents($statFile) ?: '{}', true) ?: []; + $status = $stat['status'] ?? 'unknown'; + if ($status === 'running' && !empty($stat['pid']) && !file_exists("/proc/{$stat['pid']}")) { + $status = 'error'; + } + $result[$id] = $status; +} +echo json_encode($result); diff --git a/Plugin/usr/local/emhttp/plugins/varaverk/pages/scheduler.php b/Plugin/usr/local/emhttp/plugins/varaverk/pages/scheduler.php index f0ff0a6..d8e8f0d 100644 --- a/Plugin/usr/local/emhttp/plugins/varaverk/pages/scheduler.php +++ b/Plugin/usr/local/emhttp/plugins/varaverk/pages/scheduler.php @@ -302,13 +302,12 @@ foreach ($tree as $orch) {