[systemd-devel] Newbie systemd-related question - how to run a service w/o anything but network?

Ciprian Dorin Craciun ciprian.craciun at gmail.com
Thu Aug 16 05:33:29 PDT 2012


On Thu, Jul 26, 2012 at 1:09 PM, Peter Lemenkov <lemenkov at gmail.com> wrote:
> Hello All.
> I'm trying to write a systemd service for epmd (Erlang Port Mapper
> Daemon, if someone is curious). its only purpose is to open a TCP port
> 4369 at 0.0.0.0 and act as a simple messaging (very simple actually)
> bus between erlang nodes. I'd like to run it w/o anything and under a
> most restricted system account. So far I'm using this service:


    (Notice: Slightly off topic for systemd, but very on topic for EPMD...)

    Please be aware that starting `epmd` under a service monitoring
system like systemd (or others) is not 100% possible under the current
circumstances. For a detailed explanation please see the following
thread on the Erlang mailing list:
      http://erlang.org/pipermail/erlang-questions/2011-October/061802.html

    The summary is that if someone starts an Erlang application before
your `epmd` instance starts you'll end up with your `epmd` dieing and
being restarted by systemd in a continuous loop, because each Erlang
application tries to start its own `epmd` instance. (Thus there is a
race condition here.) In the thread above I've found a workaround for
this issue but it's not quite "documented"...

    On the other hand if you would modify `epmd` to use socket
activation at least the issue will be less likely to happen. (It can
still happen if someone starts the Erlang application even before
systemd.)

    Hope it helps,
    Ciprian.


More information about the systemd-devel mailing list