Without creating a persistent unit file, run /usr/local/bin/check-once ten minutes from now.
Which command is appropriate?
systemd-run --on-active=10m creates a transient timer relative to its activation time.
Detailed explanation
systemd-run --on-calendar=10m /usr/local/bin/check-onceIncorrect. --on-calendar is for calendar expressions, not a relative ten-minute delay.
Incorrect. --on-calendar is for calendar expressions, not a relative ten-minute delay.
systemd-run --remain-after-exit=10m /usr/local/bin/check-onceIncorrect. --remain-after-exit controls service state after exit.
Incorrect. --remain-after-exit controls service state after exit.
systemctl --on-active=10m /usr/local/bin/check-onceIncorrect. This is not the systemctl syntax for creating a transient timer.
Incorrect. This is not the systemctl syntax for creating a transient timer.
systemd-run --on-active=10m /usr/local/bin/check-onceCorrect. --on-active=10m schedules the command ten minutes later.
Correct. --on-active=10m schedules the command ten minutes later.
Try it yourself
An example you can run in a temporary verification environment.
systemd-run --help 2>&1 | grep -E -- '--on-active|--on-calendar' | head -n 2Expected result
--on-activeまたは--on-calendarのtimer option説明Key points
- systemd-run creates transient units
- --on-active is relative
- No unit file needed
Notes
- Environment: systemd-run helpの読取のみ
- 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.