From d3a5af09d1194665cc4a530ed470ac574917bb83 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Sat, 23 May 2026 16:54:51 -0400 Subject: [PATCH] Create /var/log/varaverk/ on cron rebuild MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /var/log/ is RAM-based on unRAID — wiped on reboot. Creating the log directory in vv_cron_rebuild() ensures it exists before the first cron job fires, without needing a separate boot script. --- .../usr/local/emhttp/plugins/varaverk/include/scheduler.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php b/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php index 95621f1..b869e83 100644 --- a/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php +++ b/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php @@ -32,7 +32,11 @@ function vv_schedule_update(string $id, bool $enabled, string $cron): bool { return vv_cron_rebuild($schedule); } +define('LOG_DIR', '/var/log/varaverk'); + function vv_cron_rebuild(array $schedule): bool { + if (!is_dir(LOG_DIR)) mkdir(LOG_DIR, 0755, true); + $lines = ["# Varaverk — managed by plugin, do not edit manually"]; $lines[] = "# Regenerated: " . date('Y-m-d H:i:s'); $lines[] = ""; @@ -42,7 +46,7 @@ function vv_cron_rebuild(array $schedule): bool { if (empty($entry['enabled']) || empty($entry['cron']) || empty($entry['id'])) continue; $script = "$scriptsDir/{$entry['id']}"; $cron = $entry['cron']; - $lines[] = "$cron " . CRON_USER . " bash \"$script\" >> /var/log/varaverk/jobs.log 2>&1"; + $lines[] = "$cron " . CRON_USER . " bash \"$script\" >> " . LOG_DIR . "/jobs.log 2>&1"; } $lines[] = "";