This document contains management commands that system administrators are likely to run repeatedly over the lifetime of the server nodes.
Classic Linux system administration guides point to the at
command for this
task, but systemd-run
is a better alternative that does not require additional
packages and daemon processes to work.
It is important to specify an absolute path to the command to run. Under the
hood, systemd-run
creates transient timer and service units, where the service
unit has the ExecStart
property set to the specified command.
$ sudo systemd-run --description='Scheduled kernel update reboot' --on-calendar='2023-06-01 03:50:00 UTC' /usr/sbin/reboot
When run as root, machinectl
can be used to create a complete terminal login
session for a given user, unlike with su
or sudo
, which do not trigger the
startup of systemd
user daemons.
$ sudo machinectl shell <USER>@ [ABSOLUTE PATH TO COMMAND] [PARAMETERS...]