[systemd-devel] Systemd API for process management

Mantas Mikulėnas grawity at gmail.com
Mon Mar 17 02:52:44 PDT 2014


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/45393754/attachment.html>


More information about the systemd-devel mailing list