Commit graph

96 commits

Author SHA1 Message Date
Martin Joerg 42c50fdf31 man: Fix example for systemd-run 2023-11-20 11:58:44 +00:00
Zbigniew Jędrzejewski-Szmek bf63dadbc6 man: more hyperlinks and other fixes
Closes https://github.com/systemd/systemd/issues/29814.
2023-11-06 20:16:34 +01:00
Abderrahim Kitouni aefdc1124f man: update version information
As I noticed a lot of missing information when trying to implement checking
for missing info. I reimplemented the version information script to be more
robust, and here is the result.

Follow up to ec07c3c80b
2023-09-19 00:37:37 +01:00
Abderrahim Kitouni ec07c3c80b man: add version info
This tries to add information about when each option was added. It goes
back to version 183.

The version info is included from a separate file to allow generating it,
which would allow more control on the formatting of the final output.
2023-08-29 14:07:24 +01:00
Luca Boccassi 8167c56bfa run: disable --expand-environment by default for --scope
The intention was to have this option enabled by default everywhere,
but unfortunately at least one case was found where it breaks
compatibility of a program using systemd-run --scopes and expecting
variables not to be expanded:

https://sources.debian.org/src/pbuilder/0.231/pbuilder-checkparams/#L400

Example run:

systemd-run --quiet --scope --description=pbuilder_build_xfce4-notes-plugin_1.10.0-1.dsc '--slice=system-pbuilder-build-xfce4\x2dnotes\x2dplugin_1.10.0\x2d1-449932.slice' chroot /var/cache/pbuilder/build/449932 dpkg-query -W '--showformat=${Version}' apt

Restore backward compatibility and make the option disabled by default
when --scope is used, and enabled by default for other types.

In case --expand-environment is not specified and a '$' character is
detected, print a warning to nudge users toward specifying the
parameter as needed. In the future we can then flip the default.

Follow-up for 2ed7a221fa
2023-07-20 17:37:27 +01:00
Zbigniew Jędrzejewski-Szmek 2ed7a221fa run: expand variables also with --scope
This makes syntax be the same for commands which are started by the manager and
those which are spawned directly (when --scope is used).

Before:
$ systemd-run -q -t echo '$TERM'
xterm-256color

$ systemd-run -q --scope echo '$TERM'
$TERM

Now:
$ systemd-run -q --scope echo '$TERM'
xterm-256color

Previous behaviour can be restored via --expand-environment=no:
$ systemd-run -q --scope --expand-environment=no echo '$TERM'
$TERM

Fixes #22948.

At some level, this is a compat break. Fortunately --scope is not very widely
used, so I think we can get away with this. Having different syntax depending
on whether --scope was used or not was bad UX.

A NEWS entry will be required.
2023-04-24 10:02:30 +02:00
Zbigniew Jędrzejewski-Szmek de99fadd31 man/systemd-run: add examples explaining how variable expansion is performed 2023-04-24 10:02:30 +02:00
Zbigniew Jędrzejewski-Szmek f872ddd182 run: add --expand-environment=no to disable server-side envvar expansion
This uses StartExecEx to get the equivalent of ExecStart=:. StartExecEx was
added in b3d593673c, so this will not work with
older systemds.

A hint is emitted if we get an error indicating lack of support. PID1 returns
SD_BUS_ERROR_PROPERTY_READ_ONLY, but I'm checking for
SD_BUS_ERROR_UNKNOWN_PROPERTY too for safety.
2023-04-24 10:02:30 +02:00
Zbigniew Jędrzejewski-Szmek 7a17e41dcf test: drop whitespace after shell redirection operators
(The one case that is left unchanged is '< <(subcommand)'.)

This way, the style with no gap was already dominant. This way, the reader
immediately knows that ' < ' is a comparison operator and ' << ' is a shift.

In a few cases, replace custom EOF replacement by just EOF. There is no point
in using someting like "_EOL" unless "EOF" appears in the text.
2023-02-06 09:19:04 +01:00
BerndAdameit a3e03a3f18 man/systemd-run: Refer to man-pages project (man7.org) when citing bash(1) 2022-09-19 00:32:34 +09:00
Lennart Poettering 13be736d1f
Merge pull request #24408 from keszybz/execstart-escape
Properly escape ExecStart= commandlines in transient units
2022-08-25 11:40:57 +02:00
Lennart Poettering 771fe73c75
Merge pull request #24072 from poettering/remove-cgroupsv1-docs
decgroupsv1ification: first steps – remove from docs, and generate warnings
2022-08-24 17:00:53 +02:00
Zbigniew Jędrzejewski-Szmek 6a6707ce85 man/run: we accept relative paths for run
I think this is a left-over from before we changed ExecStart= to allow
non-absolute paths, *and* changed systemd-run itself to resolve paths too.
2022-08-24 09:54:45 +02:00
Zbigniew Jędrzejewski-Szmek 15102ced42 man: similar → similarly
Something *is* similar
Something *works* similarly
Something does something, similarly to how something else does something

See https://sites.ulethbridge.ca/roussel/2017/11/29/similar-and-similarly-are-they-similar/
for a clear explanation.
2022-08-23 12:14:58 +02:00
Lennart Poettering 6d48c7cf73 docs: remove documentation about cgroupsv1 settings
it's legacy. We'll continue to support it in code, but let's simplify
the docs a bit, and not mention this legacy stuff anymore.
2022-08-23 09:24:44 +02:00
Zbigniew Jędrzejewski-Szmek ff9412c152 Fix man page links
Based on linkchecker as usual.
2022-04-12 11:02:16 +02:00
наб 1e8c094cb8
man/sd-run: /bin/bash -> bash in -t example
sd-run already does PATH lookup via find_executable_full()
2021-12-12 21:13:51 +01:00
Zbigniew Jędrzejewski-Szmek 0337b3d51c run: allow --setenv=FOO 2021-08-11 09:34:45 +02:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Zbigniew Jędrzejewski-Szmek b91ae210e6 journal: adjust line about when the journal begins and ends
This comes up occasionally with new users. The phrase "Logs begin ..." is
ambiguous because it can be taken to mean the logs being displayed or all logs
(the intended meaning). Let's rephrase this as "Journal begins ..." to make
this clearer.
2020-08-17 19:48:32 +02:00
Marc-André Lureau 2c7039b316 systemd-run: add --slice-inherit
Add a new option to easily place a slice within the systemd-run slice.
2020-04-09 09:32:37 +02:00
Lennart Poettering ba45534917 man: correct the default slice for systemd-run units
As suggested in #15362
2020-04-09 09:32:13 +02:00
Zbigniew Jędrzejewski-Szmek 7f3614e547 run: propagate return code/status from the child
Fixes #13756. We were returning things that didn't make much sense:
we would always use the exit_code value as the exit code. But it sometimes
contains a exit code from the process, and sometimes the number of a signal
that was used to kill the process. We would also ignore SuccessExitStatus=
and in general whether systemd thinks the service exited successfully
(hence the issue in #13756, where systemd would return success/SIGTERM,
but we'd just look at the SIGTERM part.)

If we are doing --wait, let's always propagate the exit code/status from
the child.

While at it, make the documentation useful.
2019-11-05 21:38:21 +01:00
David Tardon 7976b9f098 run: add -u as a synonym for --unit
Other tools that do have --unit= option (journalctl and systemd-cgls)
already do this, so let's be consistent.
2019-10-23 22:06:32 +09:00
Lennart Poettering d9b8c2ef8b man: document the two new .timer settings 2019-04-02 08:20:10 +02:00
Zbigniew Jędrzejewski-Szmek 3a54a15760 man: use same header for all files
The "include" files had type "book" for some raeason. I don't think this
is meaningful. Let's just use the same everywhere.

$ perl -i -0pe 's^..DOCTYPE (book|refentry) PUBLIC "-//OASIS//DTD DocBook XML V4.[25]//EN"\s+"http^<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"\n  "http^gms' man/*.xml
2019-03-14 14:42:05 +01:00
Zbigniew Jędrzejewski-Szmek 0307f79171 man: standarize on one-line license header
No need to waste space, and uniformity is good.

$ perl -i -0pe 's|\n+<!--\s*SPDX-License-Identifier: LGPL-2.1..\s*-->|\n<!-- SPDX-License-Identifier: LGPL-2.1+ -->|gms' man/*.xml
2019-03-14 14:29:37 +01:00
Lennart Poettering badd28e158 run: add new --shell switch for spawning a shell as service
I keep running "systemd-run -t /bin/bash" to quickly get a shell running
in service context. I suspect I am not the only one, hence let's add a
shortcut for it. While we are at it, let's make it smarter, and
automatically inherit the $SHELL of the invoking user as well as the
working directory, and let's imply --pty. --shell (or -S) is hence
equivalent to "-t -d $SHELL".
2018-11-23 12:49:00 +01:00
Lennart Poettering 2d21165a4e run: add a switch for specifiying the working directory of a service
I find myself testing service management quite often with "systemd-run
-t /bin/bash". For that it is handy if the invoked shell would use the
working directory I am currently in. Hence introduce a shorthand for
that:

        $ systemd-run -dt /bin/bash

This will automatically insert a WorkingDirectory= property into the
transient service, pointing to the working directory of the caller.
2018-11-23 12:49:00 +01:00
Lennart Poettering 79905a246d man: document the new Type=exec type
And while we are at it, let's rearrange and extend the Type=
documentation a bit. Let's make it an itemized list, and let's add a
paragraph explaining which type best to use.
2018-07-25 22:48:11 +02:00
Zbigniew Jędrzejewski-Szmek 514094f933 man: drop mode line in file headers
This is already included in .dir-locals, so we don't need it
in the files themselves.
2018-07-03 01:32:25 +02:00
Lennart Poettering 30ce657e5d
Merge pull request #9301 from keszybz/man-drop-authorgroup
man: drop unused <authorgroup> tags from man sources
2018-06-14 15:29:24 +02:00
Zbigniew Jędrzejewski-Szmek 0cd41d4dff Drop my copyright headers
perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
2018-06-14 13:03:20 +02:00
Zbigniew Jędrzejewski-Szmek fdbbee37d5 man: drop unused <authorgroup> tags from man sources
Docbook styles required those to be present, even though the templates that we
use did not show those names anywhere. But something changed semi-recently (I
would suspect docbook templates, but there was only a minor version bump in
recent years, and the changelog does not suggest anything related), and builds
now work without those entries. Let's drop this dead weight.

Tested with F26-F29, debian unstable.

$ perl -i -0pe 's/\s*<authorgroup>.*<.authorgroup>//gms' man/*xml
2018-06-14 12:22:18 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Yu Watanabe a953b31a8b man: run: add missing option 2018-01-10 23:21:17 +09:00
Yu Watanabe 624dd00973 man: add explanation about transient path or socket units in systemd-run 2017-12-23 18:48:31 +09:00
Alan Jenkins 3f2d136505 man: generalize "binary" to "program" (#7668)
Systemd services are permitted to be scripts, as well as binary
executables.

The same also applies to the underlying /sbin/mount and /sbin/swapon.
It is not necessary for the user to consider what type of program file
these are.  Nor is it necessary with systemd-nspawn, to distinguish between
init as a "binary" v.s. a user-specified "program".

Also fix a couple of grammar nits in the modified sentences.
2017-12-16 11:48:12 +01:00
Zbigniew Jędrzejewski-Szmek 572eb058cf Add SPDX license identifiers to man pages 2017-11-19 19:08:15 +01:00
Lennart Poettering fe9d0be90b run: add "-G" as shortcut for "--property=CollectMode=inactive-or-failed"
This option is likely to be very useful for systemd-run invocations,
hence let's add a shortcut for it.

With this new concepts it's now very easy to put together systemd-run
invocations that leave zero artifacts in the system, including when they
fail.
2017-11-16 14:38:36 +01:00
Lennart Poettering b0e8cec2dd man: document > /dev/stderr pitfalls (#7317)
Fixes: #7254
See: #2473
2017-11-14 10:51:09 +01:00
Lennart Poettering 960d20e1a9 man: minor correction for systemd-run
The meaning was acidentally inverted in
156d6036be, let's correct this.
2017-09-14 15:45:21 +02:00
Zbigniew Jędrzejewski-Szmek 156d6036be man: fix repeated use of "use" in a sentence 2017-09-13 22:11:32 +02:00
Lennart Poettering 5dca7739e8 run: add new --pipe option for including "systemd-run" commands in shell pipelines
In this mode, we'll directly connect stdin/stdout/stderr of the invoked
service with whatever systemd-run itself is invoked on. This allows
inclusion of "systemd-run" commands in shell pipelines, as unlike
"--pty" this means EOF of stdin/stdout/stderr are propagated
independently.

If --pty and --pipe are combined systemd-run will automatically pick the
right choice for the context it is invoked in, i.e. --pty when invoked
on a TTY, and --pipe otherwise.
2017-09-12 16:28:12 +02:00
Lucas Werkmeister c04becfa72 man: document that systemd-run --on-* cannot be used with --pty 2017-02-07 16:26:02 +01:00
Rike-Benjamin Schuppner b03ec00960 man: fix flag in systemd-run (#5107) 2017-01-20 03:10:30 +03:00
Lennart Poettering 7f129a1f7c man: document that "systemd-run -M" propagates exit codes, and "machinectl shell" does not
This adds a brief explanation, suggesting the use of "systemd-run -M" to
acquire exit status/code information for the invoked process.

My original plan was to propagate the exit code/status in "machinectl
shell" too, but this would mean we'd have to actively watch the shell's
runtime status, and thus would need full, highly privileged and
continious access to the container's system manager, the way
"systemd-run" does it. This would be quite a departure from the
simplistic, low-priviliged OpenShell() bus call implementation of the
current code, that really just acquires a PTY device with a shell
connected.

Moreover it would blur the lines between the two commands even further,
which I think is not desirable. Hence, from now on:

    "machinectl shell" is the full-session, interactive shell for human
    users

    "systemd-run -M …" is the low-level tool, that supports
    on-interactive mode, and is more configurable and suitable for
    streaming.

Fixes: #4215
2016-12-27 18:32:45 +01:00
Thomas Hindoe Paaboel Andersen 2dd678171e man: typo fixes
A mix of fixes for typos and UK english
2016-10-12 23:02:44 +02:00