[systemd-devel] Systemd API for process management

Vetoshkin Nikita nikita.vetoshkin at gmail.com
Mon Mar 17 03:10:29 PDT 2014


Thanks!
Yep, I know about DBus, but I'm poking systemd from Python and I don't
quite like the existing bindings. I think --json option for journal
contents in systemctl made me think there could a way to use command line
from scripts. Anyway, I was tending to use DBus.
What about resource usage, any way to get that?
Are there any estimates about "single user bus" you were talking about?


On Mon, Mar 17, 2014 at 1:52 PM, Mantas Mikulėnas <grawity at gmail.com> wrote:

> On Mar 17, 2014 8:51 AM, "Vetoshkin Nikita" <nikita.vetoshkin at gmail.com>
> wrote:
> >
> > Hi there!
> > I'm exploring possibility to use systemd as process manager /
> "containizer" for Apache Mesos (http://mesos.apache.org). At the moment
> I'm trying to use systemctl/systemd-run to implement following:
> > * Start process with specified restrictions (It works wih systemd 211)
> > * Stop process - systemctl stop/ kill works too.
> > * Read process status - systemctl lacks robot readable output of process
> status.
> > * Reap process status:
> >   * there is "systemctl reset-failed" - but it reaps all failed units
> >   * services exited with 0 exit code are gone completely (maybe it's not
> an issue)
> > * Read container (cgroup) resource usage - it is possible to do that
> manually, but I think it could be great to have an API.
> > * Start processes in --user systemd instance
> >   When I call systemd-run --user env I get "Failed to create message:
> Input/output error", digging with strace shows that dbus starts service
> "/usr/share/dbus-1/services/org.freedesktop.systemd1.service" which
> has Exec=/bin/false inside. I'm using Fedora 20 with systemd-211 directly
> from koji.
> >
> > I'd appreciate any guides, hints, suggestions. Thanks!
>
> There *is* an API, and has been since day one – the DBus interface [1].
> It's also what systemctl itself uses to talk to systemd. (So systemctl's
> output is not machine readable because it's the human interface.)
>
> In addition to systemd itself, almost all other daemons – logind,
> machined, timedated, etc. – have their own DBus interfaces, you'll find
> detailed descriptions in the same website.
>
> (For systemd-run --user, however, you will need to connect to systemd's
> private socket or to enable the "user bus" somehow and connect to that. The
> option expects a single user bus (which is still a future thing), instead
> of the current per-session bus that it's currently trying to find your
> systemd --user instance on...)
>
> [1] http://www.freedesktop.org/wiki/Software/systemd/dbus/
>
> --
> Mantas Mikulėnas <grawity at gmail.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140317/7efbf196/attachment-0001.html>


More information about the systemd-devel mailing list