Fix invalid Systemd OnCalendar syntax (Issue #3) - #9
Conversation
|
You can check the copilot review of the same change here: jochym#1 |
|
@benjaminshafii can you look at this fix and maybe merge it? This is a small change. |
|
lgtm |
Verified ✓Independently verified this fix — the behavior is exactly as described. $ systemd-analyze calendar "* *-*-* 09:00:00"
Invalid argument ✗
$ systemd-analyze calendar "*-*-* 09:00:00"
OK — daily at 09:00 ✓
$ systemd-analyze calendar "Mon *-*-* 08:30:00"
OK — Mondays at 08:30 ✓The fix is correct and aligns with |
|
@jochym @benjaminshafii Thanks for the fix! Anying speaking against merging this change and release it? |
|
I confirm this is problem for systemd users. This PR works. Please merge. |
|
Please merge this PR |
|
Would love to see this go in @benjaminshafii if you can get to it. |
Summary
This PR fixes an issue where the
OnCalendarsyntax for systemd timers was generated incorrectly when the weekday was not specified (represented by*).Changes
cronToSystemdCalendarsinsrc/index.tsto conditionally include the weekday in theOnCalendarstring.systemd.time(7), the weekday should be omitted if it is not specifically required, as systemd does not accept*as a valid weekday specifier in this context.Verification
0 9 * * *(daily at 09:00) now correctly generatesOnCalendar=*-*-* 09:00:00(previously* *-*-* 09:00:00).30 8 * * 1(Mondays at 08:30) correctly generatesOnCalendar=Mon *-*-* 08:30:00.systemd-analyze calendar.bun run build.Fixes #3