<p dir="ltr">On Mar 17, 2014 8:51 AM, "Vetoshkin Nikita" <<a href="mailto:nikita.vetoshkin@gmail.com">nikita.vetoshkin@gmail.com</a>> wrote:<br>
><br>
> Hi there!<br>
> I'm exploring possibility to use systemd as process manager / "containizer" for Apache Mesos (<a href="http://mesos.apache.org">http://mesos.apache.org</a>). At the moment I'm trying to use systemctl/systemd-run to implement following:<br>

> * Start process with specified restrictions (It works wih systemd 211)<br>
> * Stop process - systemctl stop/ kill works too.<br>
> * Read process status - systemctl lacks robot readable output of process status.<br>
> * Reap process status:<br>
>   * there is "systemctl reset-failed" - but it reaps all failed units<br>
>   * services exited with 0 exit code are gone completely (maybe it's not an issue)<br>
> * Read container (cgroup) resource usage - it is possible to do that manually, but I think it could be great to have an API.<br>
> * Start processes in --user systemd instance<br>
>   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.<br>

><br>
> I'd appreciate any guides, hints, suggestions. Thanks!</p>
<p dir="ltr">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.)</p>

<p dir="ltr">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.</p>
<p dir="ltr">(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...)</p>

<p dir="ltr">[1] <a href="http://www.freedesktop.org/wiki/Software/systemd/dbus/">http://www.freedesktop.org/wiki/Software/systemd/dbus/</a></p>
<p dir="ltr">-- <br>
Mantas Mikulėnas <<a href="mailto:grawity@gmail.com">grawity@gmail.com</a>></p>