Scheduler: card layout, per-job logs, live log panel
- Per-job log files replace single jobs.log: each script writes to /var/log/varaverk/<Category>/<script>.log mirroring the job ID - api/log.php: serves last 200 lines of a job's log file with mtime timestamp; supports POST ?clear=1 to truncate - Scheduler page redesigned as full-width cards (one per orchestrator) with Save + Log buttons; Log toggles an inline panel that polls every 3 seconds and auto-scrolls — same pattern as unRAID User Scripts - Children shown under Advanced with identical per-job log panels - CSS: vv-sched-card, vv-log-panel, vv-log-pre, vv-btn-sm
This commit is contained in:
@@ -34,6 +34,10 @@ function vv_schedule_update(string $id, bool $enabled, string $cron): bool {
|
||||
|
||||
define('LOG_DIR', '/var/log/varaverk');
|
||||
|
||||
function vv_job_log_path(string $id): string {
|
||||
return LOG_DIR . '/' . preg_replace('/\.sh$/', '.log', $id);
|
||||
}
|
||||
|
||||
function vv_cron_rebuild(array $schedule): bool {
|
||||
if (!is_dir(LOG_DIR)) mkdir(LOG_DIR, 0755, true);
|
||||
|
||||
@@ -44,9 +48,11 @@ function vv_cron_rebuild(array $schedule): bool {
|
||||
$scriptsDir = SCRIPTS_DIR;
|
||||
foreach ($schedule as $entry) {
|
||||
if (empty($entry['enabled']) || empty($entry['cron']) || empty($entry['id'])) continue;
|
||||
$script = "$scriptsDir/{$entry['id']}";
|
||||
$cron = $entry['cron'];
|
||||
$lines[] = "$cron " . CRON_USER . " bash \"$script\" >> " . LOG_DIR . "/jobs.log 2>&1";
|
||||
$script = "$scriptsDir/{$entry['id']}";
|
||||
$logFile = vv_job_log_path($entry['id']);
|
||||
$logDir = dirname($logFile);
|
||||
if (!is_dir($logDir)) mkdir($logDir, 0755, true);
|
||||
$lines[] = "{$entry['cron']} " . CRON_USER . " bash \"$script\" >> \"$logFile\" 2>&1";
|
||||
}
|
||||
$lines[] = "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user