diff --git a/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php b/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php index 0ef9c76..a07951d 100644 --- a/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php +++ b/Plugin/usr/local/emhttp/plugins/varaverk/include/scheduler.php @@ -1,13 +1,12 @@ /dev/null') ?: ''; + $filtered = preg_replace('/^[^\n]*run_job\.sh[^\n]*\n?/m', '', $current); + $ours = file_get_contents(CRON_FILE); + $combined = rtrim($filtered) . "\n\n" . $ours . "\n"; + $tmp = tempnam('/tmp', 'varaverk_cron_'); + file_put_contents($tmp, $combined); + exec('crontab -c /etc/cron.d - < ' . escapeshellarg($tmp)); + unlink($tmp); + } return true; }