[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Making daemons compatible with systemd [was: Minimal init]



> From what I've seen in Lennart's posts, adding systemd support doesn't
> seem to be too complicated.

No.  No changes at all are necessary to be compatible with systemd.
This is a very impressive feature of systemd; at the same time, this is
what complicates systemd, and creates a dependency on cgroups.

If you have a daemon that forks and creates a pidfile, just say

  Type=forking
  PIDFile=/var/run/daemon.pid

If you have a daemon that forks and doesn't create a pidfile, systemd
will try to guess the main pid.  I kid you not.

If you have a daemon that doesn't fork and is able to satisfy its
dependencies straight away, just say

  Type=simple

If you have a daemon that doesn't fork and needs some time before it can
satisfy its dependencies (say, because it needs to create some sockets
first) but advertises itself on dbus, just say

  Type=dbus

Finally, if you have a deamon that doesn't fork, cannot satisfy its
dependencies straight away, and doesn't advertise itself on dbus, you
need to add three lines of code to your daemon (to notify systemd that
it's finished initialising), link with an MIT/X11-licensed file provided
with systemd, and say

  type=notify

Is that cool?  Is that bloat?  I say yes to both.

-- Juliusz


Reply to: