systemd-run:tldr:19d09
systemd-run: Share the terminal with the program (allowing interactive input/output) and make sure the execution details remain after the program exits.
$ systemd-run --remain-after-exit --pty ${command}
try on your machine
The command systemd-run
is used to start and manage background services using systemd, the init system in many modern Linux distributions. Here is an explanation of each part of the command:
systemd-run
: This is the main command being executed.--remain-after-exit
: This option tells systemd to keep the service running even after the command inside it has completed.--pty
: This option requests for a pseudo terminal (PTY) to be provided for the service. A PTY is a software emulation of a terminal, which allows interacting with the service as if it were a separate process with its own terminal.${command}
: This is a placeholder for the specific command or program that you want to run as a systemd service. It should be replaced with the actual command you want to run.
By using this command, you can start a command or program as a background service under systemd, and it will continue running even after the initial execution has finished. The --pty
option is useful when interactive input/output is required for the command.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.