Skip to content
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

Merged
merged 3 commits into from Apr 13, 2016

Conversation

pieterlexis
Copy link
Contributor

We now also install our dnsdist.service file from make install.

Needs review

@pieterlexis pieterlexis force-pushed the dnsdist-systemd-notify-support branch from f08bdf6 to ec22bbb Compare April 7, 2016 13:12
@rgacogne
Copy link
Member

rgacogne commented Apr 8, 2016

Nice! Perhaps we could also fallback to 'simple' if systemd support is not available, like weakforced does since 1?

@pieterlexis
Copy link
Contributor Author

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.

@pieterlexis pieterlexis force-pushed the dnsdist-systemd-notify-support branch from ec22bbb to b141d4d Compare April 8, 2016 13:50
sock = getenv("NOTIFY_SOCKET");
if(sock != NULL) // Are we indeed running inside of systemd?
g_cmdLine.beSupervised=true;
#endif
Copy link
Member

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?

Copy link
Contributor Author

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"])
Copy link
Member

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).

Copy link
Contributor Author

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

@pieterlexis pieterlexis force-pushed the dnsdist-systemd-notify-support branch 6 times, most recently from e26d287 to 0cd2a77 Compare April 12, 2016 20:16
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)
@pieterlexis pieterlexis force-pushed the dnsdist-systemd-notify-support branch from 0cd2a77 to a1c0a38 Compare April 12, 2016 20:27
@pieterlexis
Copy link
Contributor Author

I fixed up this PR so our packages use this and tested the resulting packages

@rgacogne rgacogne merged commit 369bec1 into PowerDNS:master Apr 13, 2016
@pieterlexis pieterlexis deleted the dnsdist-systemd-notify-support branch April 13, 2016 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants