[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#252251: resolvconf: Adding support for nscd



On Wed, 2004-06-02 at 12:01, Hugo Haas wrote:
> nscd seems to need to be told that resolv.conf has changed [...]

You are right.  Thanks for pointing this out.


> Creating an nscd script in /etc/resolvconf/update-libc.d to tell it to
> reload its configuration should do the trick:
> 
>   #!/bin/sh -e
>   /etc/init.d/nscd reload
>   exit 0

It would probably be better if nscd were reloaded here if and
only if the hosts cache is enabled.  Here's a revised script.
(Beware of stupid evolution line wrapping.)

#!/bin/sh
# Make nscd aware of changes to resolv.conf, if necessary

[ -x /etc/init.d/nscd ] || exit 0

hosts_cache_is_enabled()
{
	[ -s /etc/nscd.conf ] || return 1
	grep -q '[[:space:]]*enable-cache[[:space:]]\+hosts[[:space:]]\+yes' /etc/nscd.conf
}

if hosts_cache_is_enabled ; then
	/etc/init.d/nscd restart
fi


I found that I had to use 'restart' rather than 'reload' because
there is a bug in the nscd initscript.

$ sudo /etc/init.d/nscd start
Starting Name Service Cache Daemon: nscd.
$ ps -C nscd
  PID TTY          TIME CMD
31592 ?        00:00:00 nscd
31593 ?        00:00:00 nscd
31594 ?        00:00:00 nscd
31595 ?        00:00:00 nscd
31596 ?        00:00:00 nscd
31597 ?        00:00:00 nscd
31598 ?        00:00:00 nscd
$ sudo /etc/init.d/nscd reload
Reloading Name Service Cache Daemon configuration...
start-stop-daemon: warning: failed to kill 31597: No such process
start-stop-daemon: warning: failed to kill 31596: No such process
start-stop-daemon: warning: failed to kill 31595: No such process
start-stop-daemon: warning: failed to kill 31594: No such process
start-stop-daemon: warning: failed to kill 31593: No such process
start-stop-daemon: warning: failed to kill 31592: No such process
done.
$ ps -C nscd
  PID TTY          TIME CMD
$


I could add this script to the resolvconf package but it really
belongs in the nscd package.  What do you think?

--
Thomas



Reply to: