Memory again

Stefan Schmidt zaphodb at mandelbrot.zaphods.net
Thu Feb 10 17:07:45 UTC 2005


On 2005-02-10, Thomas Kinghorn [MTNNS -Rosebank] <thomask at mtnns.net> wrote:
> I have recently upgraded to bind 9.3.0
> max-cache-size 75M;
> Any ideas?
Doesn't work for me either, so...

Here's my workaround for my caching-only servers (Linux-only, sorry):
* * * * * /root/bin/named.restart.pl /var/named/var/run/named.pid

#!/usr/bin/perl -w
# restarts named via /etc/init.d/bind start if no pidfile and process
# named named present or if pidfile but /proc/$pid/status and process
# named named not present
use strict;
my $pidfile="";
if((defined $ARGV[0])&&($ARGV[0]=~/^[A-Za-z0-9\-\.\_\/]+$/)) {
        $pidfile=$ARGV[0];
} else {
        die("usage: named.restart.pl <path-to-pidfile>");
}
if(-e $pidfile) {
        if(open PID,"<$pidfile") {
                my $pid=<PID>;
                close PID;
                chomp $pid;
                if(!-e "/proc/$pid/status") {
                        my @procs=`ps auxw 2>&1`;
                        if(!grep(/\/named /, at procs)) {
                                print STDERR "pidfile ok but process named not 
found - restarting...";
                                unlink "$pidfile";
                                `/etc/init.d/bind start`;
                        }
                }
        } else {
                die("ERROR: pidfile: \"$pidfile\" existed but unable to open for
reading - better luck next time!");
        }
} else {
        my @procs=`ps auxw 2>&1`;
        if(!grep(/\/named /, at procs)) {
                print STDERR "no pidfile or process named found - restarting..
.";
                `/etc/init.d/bind start`;
        } else {
                `logger "process named running but no pidfile ;-( please fix 
it."`;
        }
}

Btw: If this resolver is a busy one, perhaps you should upgrade memory as my
     resolvers consume around 258m RES with bind9.2 and 330m with bind8

	Stefan



More information about the bind-users mailing list