SYSTEMD-RUN(1) systemd-run SYSTEMD-RUN(1) (NAME) systemd-run - scope service service path socket timer (SYNOPSIS) systemd-run [OPTIONS...] COMMAND [ARGS...] systemd-run [OPTIONS...] [PATH OPTIONS...] {COMMAND [ARGS...]} systemd-run [OPTIONS...] [SOCKET OPTIONS...] {COMMAND [ARGS...]} systemd-run [OPTIONS...] [TIMER OPTIONS...] {COMMAND [ARGS...]} (DESCRIPTION) systemd-run .service .scope COMMAND . .path .socket .timer .service . systemctl list-units . . systemd-run ( --no-block --wait --pipe --pty ). scope systemd-run . systemctl list-units . . --scope ( ). path socket timer --on-calendar= ( ) path socket timer . path socket timer path socket timer (trigger) . --unit= COMMAND . systemd-run .path .socket .timer . systemd-run simple Type= systemd.service(5) . ( systemd-run) fork() execve() . exec ( --property=Type=exec) systemd-run . systemd-run (variable expansion) . ("$") "$$" (escape) . --expand-environment=no . (OPTIONS) : --scope .scope .service ( ). 206. --unit=, -u . 206. --property=, -p scope . set-property systemctl(1) . 211. --description= scope path socket timer. . Description= systemd.unit(5) . 206. --slice= .service .scope (slice) 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=BOOL . () "${VARIABLE}" ExecStart= . --scope systemd-run . bash(1) . systemd.service(5) . "$" . 254. -r, --remain-after-exit . . RemainAfterExit= systemd.service(5) . --wait --scope --pty --pty-late --pipe . 207. --send-sighup scope SIGTERM SIGHUP . . SendSIGHUP= systemd.kill(5) . 207. --service-type= . Type= systemd.service(5) . --scope . simple . 211. --uid=, --gid= . 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 NAME[=VALUE], --setenv=NAME[=VALUE] . . "=" VALUE . Environment= systemd.exec(5) . 211. --pty, -t TTY systemd-run . / . 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 (pipelines) . 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. --output= journalctl(1) . 261. --on-active=, --on-boot=, --on-startup=, --on-unit-active=, --on-unit-inactive= (monotonic timer) . 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 (trigger) . OnClockChange= OnTimezoneChange= systemd.timer(5) . --timer-property=OnClockChange=yes --timer-property=OnTimezoneChange=yes . --scope --pty . 242. --path-property=, --socket-property=, --timer-property= path socket timer . --property= path socket timer . set-property systemctl(1) . --scope --pty . 218. --no-block . systemd-run . . --wait --scope . 220. --wait . . ( ) . ( CPU IO IP cgroup ) . --quiet . --no-block --remain-after-exit --scope path socket timer . 232. -G, --collect . systemctl reset-failed . . << >> (garbage collection) . --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= ) . / . --scope . 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 HOST . IPv6 (brackets) . -M, --machine= . "@" . ".host" ( : "--user --machine=lennart@.host"). "@" root . "@" ( ) ".host" . -C, --capsule= (capsule) . . capsule@.service(5) . 256. --no-ask-password . -h, --help . --version . --json=MODE JSON . "short" ( ) "pretty" ( ) "off" ( JSON ) . --no-pager (pager) . --help . ( .) 258. --json= --scope --pty --pty-late --pipe --verbose path socket timer . . (EXIT STATUS) 0 . systemd-run . systemd-run . 0 SuccessExitStatus= systemd.service(5) . (EXAMPLES) . 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 . # systemd-run -p IOWeight=10 updatedb updatedb(8) I/O 10 . IOWeight= systemd.resource- control(5) . . (touch) . # 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. . tty bash(1) TTY . # systemd-run -t --send-sighup bash . 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 scope . systemd.scope(5) systemd.service(5) screen . screen (session scope) . KillUserProcesses=yes logind.conf(5) ( "no" ) . user@.service . user@.service . <<>> (lingering) . user@.service . screen . : $ loginctl enable-linger . $ systemd-run -t echo "<${INVOCATION_ID}>" '<${INVOCATION_ID}>' <> <5d0149bfa2c34b79bccb13074001eb20> ( ) ( ). echo(1) ["/usr/bin/echo", "<>", "<${INVOCATION_ID}>"] systemd(1) ${INVOCATION_ID} . . . systemd(1) --expand-environment=no . (escape) . : $ systemd-run --expand-environment=no -t bash \ -c 'echo $SHELL $$ >/dev/stdout' /bin/bash 12345 bash(1) . "$SHELL" "$$" echo ( ). . $ 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 . (SEE ALSO) 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) (NOTES) 1. ANSI () https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters systemd 261.2 SYSTEMD-RUN(1)