systemd-Timer statt Cron #41

Closed
thorsten.spille wants to merge 0 commits from thorsten.spille/feature-12-systemd-timer into main AGit

Setzt #12 um.

Änderung

  • Units bashclub-zsync@.service (oneshot, /etc/bashclub/%i.conf, Ausgabe ins Journal) und bashclub-zsync@.timer (Default daily, Persistent=true); Instanz = Configname
  • bashclub-zsync-timer
    • enable <name> [<OnCalendar>] [--user <user>] [--log <datei>]: Zeitplan, Benutzer, Logdatei als Drop-ins; Zeitplan per systemd-analyze geprüft
    • disable <name>, list (Configs, Timer, Zeitplan, verbliebene Cronjobs)
    • migrate [--dry-run]: Cronjobs mit bashclub-zsync -c /etc/bashclub/<name>.conf aus /etc/crontab, /etc/cron.d, Benutzer-Crontabs und /etc/cron.{hourly,daily,weekly,monthly} (Debian-Zeiten); Zeitplan nach OnCalendar (Listen, Bereiche, Schritte, Wochentage, @daily …), Benutzer und Log-Umleitung übernommen, Cron-Zeilen auskommentiert, Timer eingeschaltet. Nicht exakt Umrechenbares (@reboot, 6-22/2) wird mit Hinweis übersprungen
  • keine automatische Migration; postinst zeigt nur einen Hinweis, wenn Cronjobs existieren
  • Checkmk: Intervall aus dem Timer (letzter und nächster Start, damit z. B. Nachtpausen stimmen; vor dem ersten Auslösen gilt der letzte Erfolg als letzter Start), dann ohne Lernphase
  • zsync-autorun@ (Wechseldatenträger) und TrueNAS (Cron) unverändert
  • README „Run with systemd timers“, Betrieb ohne root auch mit Timer

Tests

  • Integration timer mit echtem systemd: einschalten, Dienst auslösen, Journal, Checkmk-Intervall aus dem Timer, Migration (Cron mit Benutzer/Log + cron.daily), Probelauf ändert nichts, zweite Migration findet nichts
  • Check-Tests mit systemctl-Stub 44/44; Units mit systemd-analyze verify geprüft; postinst-Hinweis geprüft
  • ZFS-Suite 17/17, Stub-Szenarien identisch zu main

Closes #12

🤖 Generated with Claude Code

Setzt #12 um. ## Änderung - **Units** `bashclub-zsync@.service` (oneshot, `/etc/bashclub/%i.conf`, Ausgabe ins Journal) und `bashclub-zsync@.timer` (Default `daily`, `Persistent=true`); Instanz = Configname - **`bashclub-zsync-timer`** - `enable <name> [<OnCalendar>] [--user <user>] [--log <datei>]`: Zeitplan, Benutzer, Logdatei als Drop-ins; Zeitplan per `systemd-analyze` geprüft - `disable <name>`, `list` (Configs, Timer, Zeitplan, verbliebene Cronjobs) - `migrate [--dry-run]`: Cronjobs mit `bashclub-zsync -c /etc/bashclub/<name>.conf` aus `/etc/crontab`, `/etc/cron.d`, Benutzer-Crontabs und `/etc/cron.{hourly,daily,weekly,monthly}` (Debian-Zeiten); Zeitplan nach OnCalendar (Listen, Bereiche, Schritte, Wochentage, `@daily` …), Benutzer und Log-Umleitung übernommen, Cron-Zeilen auskommentiert, Timer eingeschaltet. Nicht exakt Umrechenbares (`@reboot`, `6-22/2`) wird mit Hinweis übersprungen - **keine automatische Migration**; postinst zeigt nur einen Hinweis, wenn Cronjobs existieren - **Checkmk:** Intervall aus dem Timer (letzter und nächster Start, damit z. B. Nachtpausen stimmen; vor dem ersten Auslösen gilt der letzte Erfolg als letzter Start), dann ohne Lernphase - `zsync-autorun@` (Wechseldatenträger) und TrueNAS (Cron) unverändert - README „Run with systemd timers“, Betrieb ohne root auch mit Timer ## Tests - Integration `timer` mit echtem systemd: einschalten, Dienst auslösen, Journal, Checkmk-Intervall aus dem Timer, Migration (Cron mit Benutzer/Log + cron.daily), Probelauf ändert nichts, zweite Migration findet nichts - Check-Tests mit systemctl-Stub 44/44; Units mit `systemd-analyze verify` geprüft; postinst-Hinweis geprüft - ZFS-Suite 17/17, Stub-Szenarien identisch zu `main` Closes #12 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add systemd timers per configuration and a tool to migrate cron jobs
Some checks failed
/ build (pull_request) Successful in 25s
/ test (debian-13) (pull_request) Successful in 42s
/ test (ubuntu-26.04) (pull_request) Successful in 51s
/ test (debian-12) (pull_request) Successful in 51s
/ publish (pull_request) Has been skipped
/ package (pull_request) Successful in 0s
/ test (ubuntu-24.04) (pull_request) Successful in 44s
/ integration (pull_request) Failing after 3m17s
d92d68c36c
- units bashclub-zsync@.service (oneshot, /etc/bashclub/%i.conf, output to the
  journal) and bashclub-zsync@.timer (default daily, Persistent=true)
- bashclub-zsync-timer:
  enable <name> [<OnCalendar>] [--user] [--log]: schedule, user and log file
  as drop-ins, schedule checked with systemd-analyze; disable; list
  migrate [--dry-run]: cron jobs running bashclub-zsync -c /etc/bashclub/<name>.conf
  from /etc/crontab, /etc/cron.d, user crontabs and run-parts scripts
  (Debian times); schedule converted to OnCalendar (lists, ranges, steps,
  weekdays, @keywords; ranges with steps and @reboot are skipped with a
  hint), user and log redirection kept, cron lines commented out, timers
  enabled
- the package migrates nothing by itself, postinst shows a hint if cron jobs
  exist
- Checkmk check: interval from the timer of the configuration (last and next
  start, so pauses like nights are respected; before the first trigger the
  last successful run is the last start), no learning phase then
- README "Run with systemd timers", running without root with a timer

Tests: integration case timer on the test VM with real systemd (enable,
service run, journal, Checkmk interval, migration incl. cron.daily, user and
log file, dry run changes nothing, second migration finds nothing); check
tests with a systemctl stub (44/44); units verified with systemd-analyze;
ZFS suite 17/17; stub scenarios identical to main.

Refs #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tests: skip same_second if two snapshots cannot share a second under load
All checks were successful
/ build (pull_request) Successful in 27s
/ test (debian-13) (pull_request) Successful in 45s
/ test (ubuntu-24.04) (pull_request) Successful in 45s
/ test (debian-12) (pull_request) Successful in 51s
/ publish (pull_request) Has been skipped
/ package (pull_request) Successful in 0s
/ test (ubuntu-26.04) (pull_request) Successful in 55s
/ integration (pull_request) Successful in 3m19s
c85aa7070f
ZFS never creates two snapshots of a dataset in the same transaction
(checked with zfs program: the second one fails with EAGAIN), so two
snapshots in the same second need two transactions within one second. Under
the load of the CI run this was not reachable even after five attempts.
Ten attempts now; if it still fails, the case is reported as skipped instead
of failed. The result line lists skipped cases.

Refs #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Manuell nach main gemergt (08b37ed), CI inkl. publish nach testing grün. Schließe den PR.

Manuell nach `main` gemergt (08b37ed), CI inkl. publish nach testing grün. Schließe den PR.
thorsten.spille closed this pull request 2026-10-16 00:32:14 +02:00
All checks were successful
/ build (pull_request) Successful in 27s
/ test (debian-13) (pull_request) Successful in 45s
/ test (ubuntu-24.04) (pull_request) Successful in 45s
/ test (debian-12) (pull_request) Successful in 51s
/ publish (pull_request) Has been skipped
/ package (pull_request) Successful in 0s
/ test (ubuntu-26.04) (pull_request) Successful in 55s
/ integration (pull_request) Successful in 3m19s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bashclub/zsync!41
No description provided.