Create /var/log/varaverk/ on cron rebuild
/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.
This commit is contained in:
@@ -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[] = "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user