restart nscd if running
authorJamie Cameron <jcameron@webmin.com>
Mon, 8 Jun 2009 06:10:07 +0000 (06:10 +0000)
committerJamie Cameron <jcameron@webmin.com>
Mon, 8 Jun 2009 06:10:07 +0000 (06:10 +0000)
bind8/CHANGELOG
bind8/bind8-lib.pl
bind8/restart_zone.cgi

index 17b34d9..c76952c 100644 (file)
@@ -109,3 +109,4 @@ Made the manual config file editor textboxes full-width.
 Fixed a bug that cause blocks like sortlist not be parsed properly, and possible cause Webmin to corrupt other parts of the named.conf file.
 Redirect and explanation modifiers can be viewed and edited in SPF records.
 Added a Module Config option for additional master IP addresses for remote slave zones.
+If nscd is running when BIND is restarted or a zone is applied, it will be signalled to re-read DNS caches too.
index 12b513a..03d9954 100644 (file)
@@ -1721,6 +1721,7 @@ else {
                return &text('restart_esig', $pid, $!);
                }
        }
+&refresh_nscd();
 return undef;
 }
 
@@ -3032,5 +3033,21 @@ local ($job) = grep { $_->{'user'} eq 'root' &&
 return $job;
 }
 
+# refresh_nscd()
+# Signal nscd to re-read cached DNS info
+sub refresh_nscd
+{
+if (&find_byname("nscd")) {
+       if (&has_command("nscd")) {
+               # Use nscd -i to reload
+               &system_logged("nscd -i hosts >/dev/null 2>&1 </dev/null");
+               }
+       else {
+               # Send HUP signal
+               &kill_byname_logged("nscd", "HUP");
+               }
+       }
+}
+
 1;
 
index 5f86f1f..47a728d 100755 (executable)
@@ -38,6 +38,7 @@ if ($out =~ /not found/i) {
 elsif ($? || $out =~ /failed|not found|error/i) {
        &error(&text('restart_endc', "<tt>$out</tt>"));
        }
+&refresh_nscd();
 &webmin_log("apply", $dom);
 
 $tv = $zone->{'type'};