skip @reboot line for cron

This commit is contained in:
Ebbe Baß
2026-09-09 13:50:22 +02:00
parent 5d9b3a6070
commit 9d52d869fb
+6 -1
View File
@@ -62,13 +62,18 @@ def discover_cron_expr(command_hint: str, *, archive: bool) -> Optional[str]:
``command_hint`` is a substring identifying the scrape command (e.g.
"scraper.py"); ``archive`` picks the "--archive" line vs. the plain one.
Returns None if the crontab can't be read or no line matches.
Each scrape typically has two crontab lines - an "@reboot" one and a
timed one; "@reboot" isn't a recurring schedule (croniter can't compute
a next run from it), so it's skipped in favor of the timed line.
Returns None if the crontab can't be read or no timed line matches.
"""
for line in _read_crontab_lines():
parsed = _parse_crontab_line(line)
if parsed is None:
continue
schedule, command = parsed
if schedule.lower() == "@reboot":
continue
if command_hint not in command:
continue
if ("--archive" in command) != archive: