Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 May 1998 12:30:48 -600
From:      "Robert E. Gunn" <reg@hal-pc.org>
To:        freebsd-isp@FreeBSD.ORG
Subject:   RE: Named disappeared
Message-ID:  <199805011730.MAA21183@hal-pc.org>

next in thread | raw e-mail | index | archive | help
** Reply to note from Stunt Pope <markjr@shmOOze.net> Fri, 01 May 1998 12:53:15 -0400 (EDT)
>   
>   
> On 01-May-98 mmoran@veronet.net wrote:
> > Hi to all,
> > 
> > Today, while I try to pick up my emails or check out other web sites. I
> > unable to reach there with their names like yahoo.com but able to reach
> > with IP addresses.
> > 
> > I checked out my name server (currently use 'named') and found out there is
> > no 'named' show up on ps -x command. I re-boot it to start over again and
> > it's working now and 'named' showed up on ps command. 
> > 
> > How can this happened? Are there any reason(s) why the 'named' disappeared?
> > 
> > Anyone who have same problem before? 
> > 
> > Thank you,
>   
> A friend of mine has this problem in an unpredictable and ongoing basis,
> not on freeBSD, but on Solaris 2.5.1. I ended up writing a script for
> him that he runs out of crontab that checks every 15 mins and restarts
> named if it's dead.
>   
> It may take a bit of tweaking but if you want it, I can fire you a copy.
> (Obviously the best solution is to figure out why it died and fix it,
> but if not...)
>   
> -mark

I'm including my 'namedchk' program that we were running until we
finally figured out what was killing named.  Since it can be a very
active daemon, it accumulates a lot of process time.  Anytime we
restarted it, it restarted with the system default ulimit of 300
seconds or 5 minutes--that's not enough.  Before you restart namedb as
root, type:

# ulimit -t unlimited

If that's not the problem, this program will at least keep it alive.

--8X----BEGIN namedchk-----------------------------------------------
#!/bin/ksh
# namedchk version 00.08  reg@hal-pc.org 
#========================================================================
# named check
# This routine looks for the "named" daemon in the status table
# every minute.  If the daemon is missing, it sends mail to everyone
# in the /etc/namechk.lst file, 
#========================================================================
# Last Revised UID Modification
# 970224 12:13 reg Added seperate page file "/etc/namedchk.page"
# 960331 02:20 reg Changed ulimit from 300 to unlimited
# 960311 17:57 reg Shortened test to $(ps $PID|wc -l)
# 960311 12:52 reg Installed routine from /usr/sbin/ndc
# 960307 11:43 reg Verifies root access
# 960306 13:23 reg Changed test for named
# 960218 16:25 reg Restarts named -b (Jeff's compile of 9602131131)
# 960218 15:55 reg mail to reg@hal-pc, reg@buster, jeff@hal, jeff@gensys
# 960216 12:04 reg Original namedchk
#========================================================================
#  DEBUG=true
  if [ ${DEBUG:-false} = true ];then echo "$*\n$PATH\n$PWD";sleep 2;set -xv;fi
  # HUP=1, INT=2, QUIT=3, ABRT=6, KILL=9, ALRM=14, TERM=15

  trap '$0 & exit 1' HUP	# Restarts namedchk and exits this invocation


uid=`id`			# Test for root access
if [ "$uid" = "${uid##uid=0(root)}" ]
   then
   echo "You do not currently have root privleges."
   echo "Exiting"
   exit 2
fi

ulimit -t unlimited

PID=$(cat /var/run/named.pid)	# written by named

  while  :
    do
    if [ $(ps $PID|wc -l) -ne 2 ] && [ $(ps -xa | grep " named " | grep -c -v grep) -eq 0 ]
      then
      tmpfile=/tmp/namedchk.$$
      ps -xa >$tmpfile
      for user in $(cat /etc/namedchk.lst)	# Mail to the namechk list
        do
        mail -s "named daemon is not in the status table" $user < $tmpfile
      done

      # dial pager & send message
      for user in $(cat /etc/namedchk.page)	# Page list
	do
	mail -s "named daemon is not in the status table" $user < print \
	  "named daemon is not in the status table--namedchk"
      done

      # If there is a global system configuration file, suck it in.
      if [ -f /etc/sysconfig ]
        then
        . /etc/sysconfig
      fi
      # $namedflags is imported from /etc/sysconfig
      if [ "X${namedflags}" != "XNO" ]; then
	      named ${namedflags}
	      sleep 60
              PID=$(cat /var/run/named.pid)
      fi
    fi 
    sleep 60
  done
  exit
---8X-----END namedchk----------------------------------------------

-- 
Robert Gunn  <<Team OS/2>>|Post Office Box 27474   |Voice:+1 713 960 1588
reg@hal-pc.org <<FreeBSD>>|Houston,Texas 77227-7474|Fax:  +1 713 960 9497

HAL-PC: The world's largest computer club and a lot more!

Unix IS user friendly.  It's just particular about its friends.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199805011730.MAA21183>