wiki/notebook/linux.systemd.transient-units.org
Gabriel Arazas f868f3b3da Update notebook as of 2021-08-07
With the few updates on more learning, writing, and some forward calls
for archiving which I'll be jotting down for some ideas soon.
2021-08-07 12:00:20 +08:00

1020 B

systemd transient units

You can create units on-the-go with systemd-run. Very useful for quickly creating and scheduling one-off services. This tool involves systemd services and systemd timers.

Like most systemd-related binaries, this can be run at system- and user-level (see systemd at user-level).

# This will create a user-level service file with the given command as the task.
systemd-run --user borgmatic --config emergency-config.yaml --verbose

# Create a transient timer for the service.
systemd-run --user borg-backup@external-drive.service --on-calendar=12:00

The result should give you the generated name of the unit. Then, they can be managed like an ordinary unit.