1SYSTEMD-RUN-GENERATOR(8) systemd-run-generator SYSTEMD-RUN-GENERATOR(8)
2
3
4
6 systemd-run-generator - Generator for invoking commands specified on
7 the kernel command line as system service
8
10 /usr/lib/systemd/system-generators/systemd-run-generator
11
13 systemd-run-generator is a generator that reads the kernel command line
14 and understands three options:
15
16 If the systemd.run= option is specified and followed by a command line,
17 a unit named kernel-command-line.service is generated for it and booted
18 into. The service has Type=oneshot set, and has SuccessAction=exit and
19 FailureAction=exit configured by default, thus ensuring that the system
20 is shut down as soon as the command completes. The exit status of the
21 command line is propagated to the invoking container manager, if this
22 applies (which might propagate this further, to the calling shell —
23 e.g. systemd-nspawn(7) does this). If this option is used multiple
24 times the unit file will contain multiple ExecStart= lines, to execute
25 all commands in order. The command is started as regular service, i.e.
26 with DefaultDependencies= on.
27
28 Use systemd.run_success_action= and systemd.run_failure_action= to
29 tweak how to react to the process completing. In particular assigning
30 "none" will leave the system running after the command completes. For
31 further details on supported arguments, see systemd.unit(5).
32
33 systemd-run-generator implements systemd.generator(7).
34
36 Use a command like the following to add a user to the user database
37 inside a container run with systemd-nspawn(7):
38
39 # systemd-nspawn -D mycontainer -b systemd.run='"adduser test"'
40
41 (Note the requirement for double quoting in the command line above. The
42 first level of quoting ('') is processed and removed by the command
43 shell used to invoke systemd-nspawn. The second level of quoting ("")
44 is propagated to the kernel command line of the container and processed
45 and removed by systemd-run-generator. Both together make sure both
46 words of the specified command line adduser test end up in the
47 generated unit file together and are neither split apart by the command
48 shell nor by the generator.)
49
51 systemd(1), systemctl(1), kernel-command-line(7), systemd-nspawn(7),
52 systemd.unit(5), systemd.service(5)
53
54
55
56systemd 246 SYSTEMD-RUN-GENERATOR(8)