fix(parental): не устанавливать cron-джоб если нет расписаний с квотами (убирает cron.err spam)

This commit is contained in:
Dushnilin
2026-09-01 18:50:13 +03:00
parent 324569aa53
commit 416a15a805
+19 -13
View File
@@ -251,17 +251,6 @@ function write_crontab(lines) {
return ok;
}
function install_cron() {
let line = cron_line();
let lines = crontab_lines();
for (let existing in lines)
if (trim(as_string(existing)) == line)
return 0;
push(lines, line);
log_message("cron job installed", "debug");
return write_crontab(lines) ? 0 : 1;
}
function remove_cron() {
let line = cron_line();
let changed = false;
@@ -278,6 +267,23 @@ function remove_cron() {
return write_crontab(lines) ? 0 : 1;
}
function install_cron() {
// Only install the cron tick if there is at least one schedule with a
// daily_quota_minutes limit. Without quotas the job produces nft stderr
// which crond logs as cron.err every minute — pure noise.
if (length(quota_schedules()) == 0)
return remove_cron();
let line = cron_line();
let lines = crontab_lines();
for (let existing in lines)
if (trim(as_string(existing)) == line)
return 0;
push(lines, line);
log_message("cron job installed", "debug");
return write_crontab(lines) ? 0 : 1;
}
function blocked_lists(state) {
// MAC/IP idents currently over quota. On day rollover nothing stays
// blocked because counters start fresh.
@@ -298,8 +304,8 @@ function blocked_lists(state) {
function tick() {
let schedules = quota_schedules();
if (length(schedules) == 0) {
// Nothing to quota: make sure no stale blocks survive.
sync_enforcement([], []);
// No quota schedules configured — skip all nft operations so crond
// does not produce cron.err noise from chains that don't exist.
return 0;
}