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[] = "";