fix(varaverk): remove legacy /etc/cron.d/varaverk on cron rebuild

Before update_cron was wired in, the plugin wrote directly to
/etc/cron.d/varaverk. That file persisted after the migration and
caused duplicate job firing (two watchdog instances at :00/:15/:30/:45).
The second instance hit the lock, exited with warn, and overwrote the
stat file — killing the running indicator while the first was still live.

vv_cron_rebuild() now unlinks the legacy file after every update_cron
call. Since rebuild_cron (boot event) calls vv_cron_rebuild(), the
cleanup runs on every reboot and every schedule save.
This commit is contained in:
Gmer4Lfe
2026-05-24 21:27:38 -04:00
parent bcb1956bbe
commit 253d5bf2e1
@@ -67,6 +67,8 @@ function vv_cron_rebuild(array $schedule): bool {
// Write to the plugin cron file; update_cron merges all plugin *.cron files into /etc/cron.d/root.
if (file_put_contents(CRON_FILE, implode("\n", $lines)) === false) return false;
exec('/usr/local/sbin/update_cron');
// Remove legacy direct cron file left from before update_cron migration — prevents duplicate job firing.
@unlink('/etc/cron.d/varaverk');
return true;
}