Package: pdns-recursor Version: 3.1.4-1 Hi,
As the title says... if you change socket-dir in the configuration file, the init script and rec_control by default don't see it - they insist on using the hardcoded /var/run. That is annoying in the (hopefully common) case where one uses chroot() - you have to put the control socket somewhere inside the chroot directory, and it would be a bit silly to chroot into /var/run (there are other programs' files in there). rec_control allows for the --socket-dir option to be specified, but it shouldn't be necessary, it could find that out itself. The init script just does PIDFILE=/var/run/$NAME.pid, whereas the pid file actually gets written into the socket directory (pdns_recursor.cc:writePid() defines fname as ::arg()["socket-dir"]+"/"+s_programname+".pid"). And then the error handling for that doesn't work, because: + PIDFILE=/var/run/pdns_recursor.pid ... + echo -n 'Stopping PowerDNS recursor: pdns-recursor' Stopping PowerDNS recursor: pdns-recursor+ stop + start-stop-daemon --stop --quiet --retry=HUP/30/TERM/5/KILL/5 --pidfile /var/run/pdns_recursor.pid --name pdns_recursor % echo $? 0 What really happens is: % sudo start-stop-daemon --stop --quiet --retry=HUP/30/TERM/5/KILL/5 --pidfile /var/run/pdns_recursor.pid --name pdns_recursor --verbose No pdns_recursor found running; none killed. % echo $? 1 start-stop-daemon exits with an error, and then the shell stops the execution of the entire script, because you use 'set -e'. You need to put 'set +e' at the beginning of the stop() function to get the ability to handle non-success exit values in there. But even then, that error handling is SNAFU. This is what happens: + echo -n 'Stopping PowerDNS recursor: pdns-recursor' Stopping PowerDNS recursor: pdns-recursor+ stop + set +e + start-stop-daemon --stop --quiet --retry=HUP/30/TERM/5/KILL/5 --pidfile /var/run/pdns_recursor.pid --name pdns_recursor + RETVAL=1 + '[' 1 = 2 ']' + start-stop-daemon --stop --quiet --oknodo --retry=HUP/30/KILL/5 --exec /usr/sbin/pdns_recursor + '[' 0 = 2 ']' + rm -f /var/run/pdns_recursor.pid + return 1 + case "$?" in + log_progress_msg '(not running)' ... That's just wrong. The second invocation of start-stop-daemon actually kills the running pdns_recursor process, and returns 0 because that succeeds, and that is then falsely reported. It doesn't look like the same person wrote the stop() function and the main body, because the intent is clearly not the same... The Policy manual isn't precise as to what to do in this situation. It says: The init.d scripts must ensure that they will behave sensibly if invoked [...] with stop when [the service] isn't [already running], and that they don't kill unfortunately-named user processes. The best way to achieve this is usually to use start-stop-daemon. This technically allows the current behaviour (killing instances of /usr/sbin/pdns_recursor which don't have the same pid file) but IMHO that's not right, because the sysadmin could rightfully have configured other configurations which shouldn't get killed just because they share the binaries with the main instance. The powerdns daemon (the authoritiative one) has that functionality separated into a 'force-stop' method, so it makes sense for the recursor to follow suit. The authoritative one's control program, pdns_control, also does the right thing with regard to reading variable data from the configuration file. Please fix this. TIA. -- 2. That which causes joy or happiness. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]