From 8383306831fe1f9c4624022f1663056d17158eaa Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Sat, 23 May 2026 21:03:52 -0400 Subject: [PATCH] varaverk: fix cron format and permissions for dcron Unraid's system crond is dcron (dillon's cron daemon 4.5), which reads /etc/cron.d/ for system crontabs WITHOUT a username field, and refuses to execute files that are group- or world-writable. vv_cron_rebuild() was writing "SCHED root bash ..." (with username field) and leaving the file world-writable (666), so dcron silently ignored every entry. Fixed: - Remove CRON_USER from the generated cron line format - chmod 0600 the cron file after writing it --- .../local/emhttp/plugins/varaverk/include/scheduler.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php b/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php index 91d525c..c89c5c5 100644 --- a/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php +++ b/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php @@ -59,11 +59,15 @@ function vv_cron_rebuild(array $schedule): bool { $logDir = dirname($logFile); if (!is_dir($logDir)) mkdir($logDir, 0755, true); $flags = !empty($entry['log_enabled']) ? ' --log' : ''; - $lines[] = "{$entry['cron']} " . CRON_USER . " bash \"$script\"$flags >> \"$logFile\" 2>&1"; + $lines[] = "{$entry['cron']} bash \"$script\"$flags >> \"$logFile\" 2>&1"; } $lines[] = ""; - return file_put_contents(CRON_FILE, implode("\n", $lines)) !== false; + // dcron (dillon's cron, Unraid's system crond) reads /etc/cron.d/ but refuses + // world-writable files and does not use a username field in system crontab format. + if (file_put_contents(CRON_FILE, implode("\n", $lines)) === false) return false; + chmod(CRON_FILE, 0600); + return true; } // Extract the suggested cron and label from a bash script header.