[systemd-devel] "libsystemdexec/systemd-run --exec-from-unit"
Reindl Harald
h.reindl at thelounge.net
Sun Jan 29 12:59:54 UTC 2017
Am 29.01.2017 um 07:56 schrieb Colin Walters:
> Hey so, this is is a half-baked thought, but here goes:
>
> One problem I've hit when trying to use systemd unit file
> features is that they only work when executed by systemd.
> Let's take the example of User=, but it applies to tons of
> other ones too.
>
> Wait you ask - your service runs under systemd, why
> do you care about running it not under systemd? The
> main case I hit is I often want to run my service
> under a debugger.
>
> If I just do gdb /usr/lib/myservice ... it will run as root.
> Now of course, I could runuser myservice gdb --args /usr/lib/myservice.
> But as a unit file gains more features, from WorkingDirectory
> to ProtectSystem=, I find myself wanting something like:
>
> systemd-run --exec-from-unit myservice.service /path/to/myservice/src/myservice
what you really want is something like this (that's wat dropins below
/etc/systemd/ are for to not touch the unit itself) supported by gdb
because using valgrind within a systemd unit works for many years and
the same for strace and a logfile output
i never understodd why taht stupid gdb always ends in interactive mode
instead "if thee is some crash write backtraces to file xyz and shut up"
ExecStart=/usr/bin/valgrind --tool=memcheck --leak-check=yes
--log-file=/var/log/valgrind/imapd.log /usr/sbin/dbmail-imapd -D
More information about the systemd-devel
mailing list