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
dnsdist: Add support for systemd-notify #3677
dnsdist: Add support for systemd-notify #3677
Conversation
f08bdf6
to
ec22bbb
Compare
Nice! Perhaps we could also fallback to 'simple' if systemd support is not available, like weakforced does since 1? |
After pondering this, I feel there is no reason to generate a service file at all if there are no systemd(-dev) libraries installed, as the program is not intended to be run inside of systemd. We can stick a Type=simple service file in the contrib dir and have some documentation about this. |
ec22bbb
to
b141d4d
Compare
sock = getenv("NOTIFY_SOCKET"); | ||
if(sock != NULL) // Are we indeed running inside of systemd? | ||
g_cmdLine.beSupervised=true; | ||
#endif |
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.
This can be overridden from the commandline still, I presume?
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.
not if your actually running inside systemd. There is no other way (as daemonizing will break systemd's detection of a startup and not being supervised will spawn a console with a closed stdin, leading to program termination) to do this. We could just exit(1)
here and print a message asking the user to start with --supervised
|
||
AC_DEFUN([AX_CHECK_SYSTEMD_LIBS], [ | ||
AC_CHECK_HEADER([systemd/sd-daemon.h], [ | ||
AC_CHECK_LIB([systemd-daemon], [sd_listen_fds], [libsystemddaemon="y"]) |
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.
This seems to fail on Arch because libsystemd-daemon.so has been merged into libsystemd.so a while ago (looks like it was in version 209).
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.
Even centos 7's pkg-config mentions it as 'deprecated'. Debian jessie has systemd 215, so I'll just change the systemd-daemon
to systemd
Imported https://github.com/mcgrof/funk-systemd/blob/b17396e7b1f5e93db74cae0e9123f39cf27a8339/src/m4/systemd.m4 as m4/systemd.m4 Imported https://github.com/mcgrof/funk-systemd/blob/b17396e7b1f5e93db74cae0e9123f39cf27a8339/src/m4/features.m4 as m4/ax_arg_default_enable_disable.m4
e26d287
to
0cd2a77
Compare
This patch is twofold: 1 - It detects the correct library for sd-daemon (either libsystemd-daemon (systemd pre-209) or libsystemd (systemd post-209) 2 - Detection of the library and files is only run once, even when systemd support detection is automatic (when using AX_AVAILABLE_SYSTEMD)
0cd2a77
to
a1c0a38
Compare
I fixed up this PR so our packages use this and tested the resulting packages |
We now also install our dnsdist.service file from make install.
Needs review