New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use systemd-notify(1) shell helper as fallback #573
Use systemd-notify(1) shell helper as fallback #573
Conversation
Currently external erlang library `sd_notify` is used to make systemd unit with `Type=notify` to work correctly. This library contains some C code and thus cannot be built into architecture-independent package. But it is not actually needed, as systemd provides systemd-notify(1) helper for shell scripts which serves exactly the same purpose. The only thing is that you need to add `NotifyAccess=all` to your unit file to make everything work well.
941c2de
to
466dea8
Compare
@@ -287,7 +287,7 @@ broker_start() -> | |||
case code:load_file(sd_notify) of | |||
{module, sd_notify} -> SDNotify = sd_notify, | |||
SDNotify:sd_notify(0, "READY=1"); | |||
{error, _} -> ok | |||
{error, _} -> os:cmd("systemd-notify --ready") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking out loud: os:cmd/1
always returns a string, even when execution failed. I couldn't make it throw an exception, so this is hopefully safe.
@binarin your commit message says that
should we do it in our own RPM package? |
Currently there is no systemd unit files in source tree and so there is no place where this change can be applied. RedHat maintains their unit file externally, and they will need to make that change there when And I'll keep an eye on Debian packages and will suggest to switch from |
…ero-deps Use systemd-notify(1) shell helper as fallback
@binarin someone brought up a few related questions today: should we use |
I see that every
multiple times in a row. |
The comment above means that we can't let |
I though that
works correctly and So yes, |
@binarin is this shortcoming worth delaying |
No, because old users aren't affected - as 3.6.1 still contains old code which uses |
As discussed at the end of #52
Currently external erlang library
sd_notify
is used to make systemdunit with
Type=notify
to work correctly. This library contains some Ccode and thus cannot be built into architecture-independent package.
But it is not actually needed, as systemd provides
systemd-notify(1) helper for shell scripts.
The only thing is that you need to add
NotifyAccess=all
to your unit file tomake everything work well.