SYSTEMD-RUN(1) systemd-run SYSTEMD-RUN(1) systemd-run - systemd-run [...] [...] systemd-run [...] [ ...] { [...]} systemd-run [...] [ ...] { [...]} systemd-run [...] [ ...] { [...]} systemd-run .service .scope . .path .socket .timer .service . systemctl list-units . . systemd-run ( --no-block --wait --pipe --pty ). systemd-run . systemctl list-units. . --scope ( ). --on-calendar= ( ) . . --unit= . systemd-run .path .socket .timer . systemd-run simple Type= systemd.service(5) . ( systemd-run) fork() execve() . exec ( --property=Type=exec) systemd-run . systemd-run . ("$") "$$". --expand-environment=no. : --scope .scope .service ( ). 206. --unit=, -u . 206. --property= -p . systemctl(1)'s set-property. 211. --description= . . Description= systemd.unit(5). 206. --slice= .service .scope system.slice ( --system) ( --user). 206. --slice-inherit .service .scope systemd-run . --slice= --slice= systemd-run . : systemd-run foo.slice --slice= bar. foo-bar.slice. 246. --expand-environment=_ . () "${}" ExecStart= . --scope systemd-run . bash(1) . systemd.service(5) . "$". 254. -r, --remain-after-exit . . RemainAfterExit= systemd.service(5). 207. --send-sighup SIGHUP SIGTERM. . SendSIGHUP= systemd.kill(5). 207. --service-type= . Type= systemd.service(5). --scope. simple. 211. --uid=, --gid= UNIX . User= Group= systemd.exec(5). 211. --nice= nice . Nice= systemd.exec(5). 211. --working-directory= . WorkingDirectory= systemd.exec(5). 240. --same-dir, -d --working-directory= . 240. --root-directory= . RootDirectory= systemd.exec(5). systemd-run . RootDirectory= . 259. --same-root-dir, -R --root-directory= systemd-run . 259. -E [=] --setenv=[=] . . "=" VALUE . Environment= systemd.exec(5). 211. --pty, -t systemd-run TTY . / . systemd-run --wait. --wait systemd-run TTY . shell machinectl(1) . --pipe. 219. --pty-late, -T --pty PTY . PTY ExecStartPre= --pty-late --pty . TTY ( --no-ask-password ) . 258. --pipe -P systemd-run . systemd-run . TTY . --pty . --pipe --pty . TTY --pty --pipe. systemd-run --wait. systemd-run . systemd-run . echo "hello" >/dev/stderr stderr stderr. echo "hello" >&2 . 235. --shell, -S "--pty --same-dir --wait --collect --service-type=exec $SHELL" . 240. --quiet -q . --pty TTY. 219. -v --verbose . 258. --on-active=, --on-boot=, --on-startup=, --on-unit-active=, --on-unit-inactive= . OnActiveSec=, OnBootSec=, OnStartupSec=, OnUnitActiveSec= OnUnitInactiveSec= systemd.timer(5) . --timer-property= . --scope --pty. 218. --on-calendar= . OnCalendar= systemd.timer(5). --timer-property=OnCalendar=. --scope --pty. 218. --on-clock-change, --on-timezone-change . OnClockChange= OnTimezoneChange= systemd.timer(5). --timer-property=OnClockChange=yes --timer-property=OnTimezoneChange=yes. --scope --pty. 242. --path-property=, --socket-property=, --timer-property= . --property= . set-property systemctl(1). --scope --pty. 218. --no-block . systemd-run . . --wait. 220. --wait . . ( ). ( / IP cgroup ) . --quiet. --no-block --scope . 232. -G --collect . systemctl reset-failed . . " " . --property=CollectMode=inactive-or-failed CollectMode= systemd.unit(5) . 236. --job-mode=MODE . --job-mode= systemctl(1). "fail". --job-mode=help . 258. --ignore-failure ( --collect= ) . / . 256. --background=COLOR ANSI . ANSI X3.64 SGR "40" "41" ... "47" "48;2;..." "48;5;...". ANSI Escape Code (Wikipedia)[1] . 256. --user . --system . . -H --host= . "@" . ssh ":" "/" . SSH . machinectl -H . IPv6 . -M --machine= . "@" . ".host" ( : "--user --machine=lennart@.host"). "@" (root). "@" ( ) ".host". -C --capsule= . . capsule@.service(5) . 256. --no-ask-password . -h --help . --version . --json= JSON. : "short" ( ) "pretty" ( ) "off" ( JSON ). --no-pager . --help. ( .) 258. . 0. systemd-run . systemd-run . 0 systemd SuccessExitStatus= systemd.service(5). 1. systemd # systemd-run env Running as unit: run-19945.service # journalctl -u run-19945.service Sep 08 07:37:21 bupkis systemd[1]: Starting /usr/bin/env... Sep 08 07:37:21 bupkis systemd[1]: Started /usr/bin/env. Sep 08 07:37:21 bupkis env[19948]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin Sep 08 07:37:21 bupkis env[19948]: LANG=en_US.UTF-8 Sep 08 07:37:21 bupkis env[19948]: BOOT_IMAGE=/vmlinuz-3.11.0-0.rc5.git6.2.fc20.x86_64 2. # systemd-run -p IOWeight=10 updatedb updatedb(8) / 10. systemd.resource-control(5) IOWeight=. 3. 30 . # date; systemd-run --on-active=30 --timer-property=AccuracySec=100ms /bin/touch /tmp/foo Mon Dec 8 20:44:24 KST 2014 Running as unit: run-71.timer Will run service as unit: run-71.service # journalctl -b -u run-71.timer -- Journal begins at Fri 2014-12-05 19:09:21 KST, ends at Mon 2014-12-08 20:44:54 KST. -- Dec 08 20:44:38 container systemd[1]: Starting /bin/touch /tmp/foo. Dec 08 20:44:38 container systemd[1]: Started /bin/touch /tmp/foo. # journalctl -b -u run-71.service -- Journal begins at Fri 2014-12-05 19:09:21 KST, ends at Mon 2014-12-08 20:44:54 KST. -- Dec 08 20:44:48 container systemd[1]: Starting /bin/touch /tmp/foo... Dec 08 20:44:48 container systemd[1]: Started /bin/touch /tmp/foo. 4. tty bash(1) TTY . # systemd-run -t --send-sighup bash 5. screen $ systemd-run --scope --user screen Running scope as unit run-r14b0047ab6df45bfb45e7786cc839e76.scope. $ screen -ls There is a screen on: 492..laptop (Detached) 1 Socket in /var/run/screen/S-fatima. screen systemd --user user@.service . systemd.scope(5) systemd.service(5) screen . screen . KillUserProcesses=yes logind.conf(5) . user@.service . user@.service . "" . user@.service . screen . : $ loginctl enable-linger 6. $ systemd-run -t echo "<${INVOCATION_ID}>" '<${INVOCATION_ID}>' <> <5d0149bfa2c34b79bccb13074001eb20> ( ) ( ). echo(1) ["/usr/bin/echo", "<>", "<${INVOCATION_ID}>"] systemd(1) ${INVOCATION_ID} . . 7. systemd(1) --expand-environment=no. . : $ systemd-run --expand-environment=no -t bash \ -c 'echo $SHELL $$ >/dev/stdout' /bin/bash 12345 bash(1) . "$SHELL" "$$" echo ( ). 8. $ systemd-run --user --wait true $ systemd-run --user --wait -p SuccessExitStatus=11 bash -c 'exit 11' $ systemd-run --user --wait -p SuccessExitStatus=SIGUSR1 --expand-environment=no \ bash -c 'kill -SIGUSR1 $$' 0. systemd(1) systemctl(1) systemd.unit(5) systemd.service(5) systemd.scope(5) systemd.slice(5) systemd.exec(5) systemd.resource-control(5) systemd.timer(5) systemd-mount(1) machinectl(1) run0(1) 1. ANSI () https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters 3 . . : . systemd 260.2 SYSTEMD-RUN(1)