Start the related service every day from a systemd timer using a calendar schedule.
Which [Timer] line is appropriate?
OnCalendar= defines calendar-based schedules; daily represents a daily event.
Detailed explanation
OnActiveSec=dailyIncorrect. OnActiveSec expects an elapsed duration, not the daily calendar word.
Incorrect. OnActiveSec expects an elapsed duration, not the daily calendar word.
OnBootSec=dailyIncorrect. OnBootSec is a duration after boot.
Incorrect. OnBootSec is a duration after boot.
OnCalendar=dailyCorrect. OnCalendar=daily schedules the daily event.
Correct. OnCalendar=daily schedules the daily event.
Unit=dailyIncorrect. Unit selects the target unit and does not define a schedule.
Incorrect. Unit selects the target unit and does not define a schedule.
Try it yourself
An example you can run in a temporary verification environment.
systemd-analyze calendar daily 2>&1 | sed -n '1,4p'Expected result
Normalized formとNext elapseを含むcalendar解析結果(時刻は実行時点で変化)Key points
- OnCalendar is calendar-based
- OnActiveSec is relative time
- Unit selects target
Notes
- Environment: systemd-analyzeを備えたsystemd環境 / 解析のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.