[erlang-questions] erlang and systemd: how to combine without nif

Benoit Chesneau bchesneau@REDACTED
Thu Jul 26 17:47:37 CEST 2018


nice one. Thanks!

benoît

On Wed, Jul 25, 2018 at 12:38 PM Max Lapshin <max.lapshin@REDACTED> wrote:

> While migrating to systemd from old good SysV init, I've found that it is
> a very good idea to speak to this daemon and tell him that my software is
> alive and ready.
>
>
> systemd authors offer library for this (and I suppose that they want to
> see these calls in POSIX and all other OS).
>
> Petr Lemenkov together with other commiters have written wrapper around
> this C library: https://github.com/systemd/erlang-sd_notify
>
> I was completely against this idea, because I do not want to take nif
> around library that makes a very simple call, so I've decided to write a
> code that relies on protocol in this systemd library:
>
>
> https://gist.github.com/maxlapshin/01773f0fca706acdcb4acb77d91d78bb
>
> Just drop this file to your source, add systemd as a permanent worker for
> keepalive to work and don't forget to call systemd:ready to commit start.
>
>
> Service file may look like this:
>
>
>
> [Unit]
> Description=Retroview
> After=network-online.target
> Wants=network-online.target
>
> [Service]
> Environment=HOME=/var/lib/retroview
> Environment=PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
> Environment=LANG=C
> Environment=PROCNAME=retroview
> Type=notify
> User=root
> Group=root
> LimitNOFILE=102400
> ExecStartPre=/bin/mkdir -p /var/lib/retroview
> ExecStartPre=/bin/mkdir -p /var/log/retroview
> ExecStart=/usr/bin/erl -p /opt/retroview/ebin -noinput -name
> retroview@REDACTED -s retroview
> Restart=on-failure
> TimeoutStartSec=300s
> WatchdogSec=120
> WorkingDirectory=/opt/retroview
> NotifyAccess=main
>
> [Install]
> WantedBy=multi-user.target
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180726/a5db16a6/attachment.htm>


More information about the erlang-questions mailing list