| 1 |
'\" t |
| 2 |
.TH "SYSTEMD\-RUN\-GENERATOR" "8" "" "systemd 261~rc3" "systemd-run-generator" |
| 3 |
.\" ----------------------------------------------------------------- |
| 4 |
.\" * Define some portability stuff |
| 5 |
.\" ----------------------------------------------------------------- |
| 6 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 7 |
.\" http://bugs.debian.org/507673 |
| 8 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 9 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 |
.ie \n(.g .ds Aq \(aq |
| 11 |
.el .ds Aq ' |
| 12 |
.\" ----------------------------------------------------------------- |
| 13 |
.\" * set default formatting |
| 14 |
.\" ----------------------------------------------------------------- |
| 15 |
.\" disable hyphenation |
| 16 |
.nh |
| 17 |
.\" disable justification (adjust text to left margin only) |
| 18 |
.ad l |
| 19 |
.\" ----------------------------------------------------------------- |
| 20 |
.\" * MAIN CONTENT STARTS HERE * |
| 21 |
.\" ----------------------------------------------------------------- |
| 22 |
.SH "NAME" |
| 23 |
systemd-run-generator \- Generator for invoking commands specified on the kernel command line as system service |
| 24 |
.SH "SYNOPSIS" |
| 25 |
.PP |
| 26 |
/usr/lib/systemd/system\-generators/systemd\-run\-generator |
| 27 |
.SH "DESCRIPTION" |
| 28 |
.PP |
| 29 |
systemd\-run\-generator |
| 30 |
is a generator that reads the kernel command line and understands three options: |
| 31 |
.PP |
| 32 |
If the |
| 33 |
\fBsystemd\&.run=\fR |
| 34 |
option is specified and followed by a command line, a unit named |
| 35 |
kernel\-command\-line\&.service |
| 36 |
is generated for it and booted into\&. The service has |
| 37 |
\fIType=oneshot\fR |
| 38 |
set, and has |
| 39 |
\fISuccessAction=exit\fR |
| 40 |
and |
| 41 |
\fIFailureAction=exit\fR |
| 42 |
configured by default, thus ensuring that the system is shut down as soon as the command completes\&. The exit status of the command line is propagated to the invoking container manager, if this applies (which might propagate this further, to the calling shell \(em e\&.g\&. |
| 43 |
\fBsystemd-nspawn\fR(1) |
| 44 |
does this)\&. If this option is used multiple times the unit file will contain multiple |
| 45 |
\fIExecStart=\fR |
| 46 |
lines, to execute all commands in order\&. The command is started as regular service, i\&.e\&. with |
| 47 |
\fIDefaultDependencies=\fR |
| 48 |
on\&. |
| 49 |
.PP |
| 50 |
Use |
| 51 |
\fBsystemd\&.run_success_action=\fR |
| 52 |
and |
| 53 |
\fBsystemd\&.run_failure_action=\fR |
| 54 |
to tweak how to react to the process completing\&. In particular assigning |
| 55 |
"none" |
| 56 |
will leave the system running after the command completes\&. For further details on supported arguments, see |
| 57 |
\fBsystemd.unit\fR(5)\&. |
| 58 |
.PP |
| 59 |
systemd\-run\-generator |
| 60 |
implements |
| 61 |
\fBsystemd.generator\fR(7)\&. |
| 62 |
.SH "EXAMPLE" |
| 63 |
.PP |
| 64 |
Use a command like the following to add a user to the user database inside a container run with |
| 65 |
\fBsystemd-nspawn\fR(1): |
| 66 |
.sp |
| 67 |
.if n \{\ |
| 68 |
.RS 4 |
| 69 |
.\} |
| 70 |
.nf |
| 71 |
# systemd\-nspawn \-D mycontainer \-b systemd\&.run=\*(Aq"adduser test"\*(Aq |
| 72 |
.fi |
| 73 |
.if n \{\ |
| 74 |
.RE |
| 75 |
.\} |
| 76 |
.PP |
| 77 |
(Note the requirement for double quoting in the command line above\&. The first level of quoting (\*(Aq\*(Aq) is processed and removed by the command shell used to invoke |
| 78 |
\fBsystemd\-nspawn\fR\&. The second level of quoting ("") is propagated to the kernel command line of the container and processed and removed by |
| 79 |
\fBsystemd\-run\-generator\fR\&. Both together make sure both words of the specified command line |
| 80 |
\fBadduser test\fR |
| 81 |
end up in the generated unit file together and are neither split apart by the command shell nor by the generator\&.) |
| 82 |
.SH "SEE ALSO" |
| 83 |
.PP |
| 84 |
\fBsystemd\fR(1), \fBsystemctl\fR(1), \fBkernel-command-line\fR(7), \fBsystemd-nspawn\fR(1), \fBsystemd.unit\fR(5), \fBsystemd.service\fR(5) |