Package: pdns-recursor Version: 2.9.17-10 Severity: normal Tags: patch First I report some problems, then I suggest a solution. :)
* On stop, resolvconf is told to delete the resolvconf record after the daemon is stopped. It would be better to do this before the daemon is stopped so that no new queries are sent to the daemon just when it is about to be killed. * The record should be called 'lo.pdns-recursor' so that it does not conflict with records created by other nameservers which could conceivably by running on the same machine. (pdns-recursor does not Conflict with any other packages, so I infer that this is possible. Anyway, there is no reason not to give the record a unique name.) * Currently in the stop method the initscript sends a signal and then exits immediately and unconditionally. However, the script should not exit before the daemon has really stopped. More precisely, it should not exit before the daemon releases resources that could be needed by other daemons that are starting in the same runlevel change or dpkg run. Furthermore, if the daemon could not be stopped then the script should exit with an error status. (Admittedly, many initscripts in Debian have this shortcoming.) * On restart, a "sleep 3" is used to ensure that the daemon is restarted after it is stopped. This either wastes time or is unreliable. For the same reason, the previous problem isn't best solved by adding a sleep to the end of the stop method. * The script does "test -x $DAEMON" runs the daemon using $NAME, which is inconsistent. * The daemon is started using the command $NAME --daemon 2>&1 /dev/null As the daemon does not take any non-option arguments (according to the man page), I infer that you really meant to do: $NAME --daemon 2>&1 >/dev/null However, I don't see why you want to hide the daemon's rather brief startup message. [EMAIL PROTECTED]:~$ sudo /usr/sbin/pdns_recursor --daemon Apr 16 18:53:50 Incoming query source port: 53 Apr 16 18:53:50 Done priming cache with root hints The cost is great: you also hide the daemon's error messages, if any. If the startup messages are superfluous then the daemon source should be patched in order to suppress them. * Neither the daemon nor the initscript deletes the pidfile on stop. * Solution I wrote the initscripts for dnsmasq and pdnsd which, although possibly imperfect, are less imperfect. Each uses start-stop-daemon to test for running instances of the daemon, properly handles various failure cases and interfaces with resolvconf correctly. I attach an initscript like theirs for pdns-recursor. I have implemented the "Don't really start unless a certain environment variable is set to a certain value" feature even though I don't like it when maintainers try to undermine the standard mechanism for enabling and disabling services in runlevels. :/ If you find any problems with the initscript then please discuss them with me. If the problem turns out to be real then I would like to fix any similar problems in the dnsmasq and/or pdnsd initscripts. The following log shows that the initscript works. The daemon does produce ugly messages, but as I said earlier, these should be dealt with in the daemon source. One possibility would be to change the daemon to print them on standard output rather than on standard error and then divert only standard output to /dev/null. This would eliminate the unwanted startup messages without hiding error messages. # # Note that in the following case START is unset # ./pdns-recursor start Not starting PowerDNS recursor -- disabled. # START=yes ./pdns-recursor start Starting PowerDNS recursor: pdns_recursorApr 16 19:26:55 Incoming query source port: 53 Apr 16 19:26:55 Done priming cache with root hints . # START=yes ./pdns-recursor start Starting PowerDNS recursor: pdns_recursor (already running). # ./pdns-recursor stop Stopping PowerDNS recursor: pdns_recursor. # ./pdns-recursor stop Stopping PowerDNS recursor: pdns_recursor (not running). # START=yes ./pdns-recursor restart Restarting PowerDNS recursor: pdns_recursorApr 16 19:27:19 Incoming query source port: 53 Apr 16 19:27:19 Done priming cache with root hints . # START=yes ./pdns-recursor restart Restarting PowerDNS recursor: pdns_recursorApr 16 19:27:21 Incoming query source port: 53 Apr 16 19:27:21 Done priming cache with root hints . # # Note that in the following cases START is unset # ./pdns-recursor restart Stopping PowerDNS recursor: pdns_recursor. # ./pdns-recursor restart Stopping PowerDNS recursor: pdns_recursor (not running). -- System Information: Debian Release: 3.1 APT prefers testing APT policy: (500, 'testing'), (50, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.11 Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15) Versions of packages pdns-recursor depends on: ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an ii libgcc1 1:3.4.3-12 GCC support library ii libstdc++5 1:3.3.5-8 The GNU Standard C++ Library v3 -- no debconf information
pdns-recursor
Description: application/shellscript