I need to schedule a command to run at a certain time in the future. systemd-run
with the --on-calendar
option seems like it can do that, except that it seems the service is only stored ephemerally and is lost if the host reboots. And in this case the host will certainly reboot before I need to the command to run.
I know I could manually write service and timer files, but that is a little less convenient than using systemd-run
for a one-off task, and I need to go back and clean up the service files aftewards. Is there a way to tell systemd-run
to persist the job across reboots?
No. Transient units in tmpfs at
/run/systemd/transient/
don't survive reboots.Timer units with OnCalendar conditions can be put in persistent locations like
/etc/systemd/system/
Outside of systemd's domain, atd will run a thing at a time, and clean up its spool when done.