mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-02-07 12:19:31 +00:00
1 line
2.3 KiB
JSON
1 line
2.3 KiB
JSON
{"pageProps":{"metadata":{"date":"2021-08-02 12:01:49 +08:00","date_modified":"2022-04-16 20:01:51 +08:00","language":"en","source":""},"title":"systemd transient units","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can create units on-the-go with "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"systemd-run"}]},{"type":"text","value":".\nVery useful for quickly creating and scheduling one-off services.\nThis tool mainly involves "},{"type":"element","tagName":"a","properties":{"href":"/linux.systemd.services"},"children":[{"type":"text","value":"systemd services"}]},{"type":"text","value":" and "},{"type":"element","tagName":"a","properties":{"href":"/linux.systemd.timers"},"children":[{"type":"text","value":"systemd timers"}]},{"type":"text","value":".\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Like most systemd-related binaries, this can be run at system- and user-level (see "},{"type":"element","tagName":"a","properties":{"href":"/linux.systemd#systemd-at-user-level"},"children":[{"type":"text","value":"systemd at user-level"}]},{"type":"text","value":").\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"# This will create a user-level service file with the given command as the task.\nsystemd-run --user borgmatic --config emergency-config.yaml --verbose\n\n# Create a transient timer for the service.\nsystemd-run --user borg-backup@external-drive.service --on-calendar=12:00\n"}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The result should give you the generated name of the unit.\nThen, they can be managed like an ordinary unit.\nUnit generated this way will persist until the next boot.\nIf you want to manage them on a permanent basis, create the appropriate unit files for them.\n"}]}]},"backlinks":[{"path":"/linux.systemd","title":"systemd"}]},"__N_SSG":true} |