How do you ask your nameserver is he's up or not

Christopher Wagner chrisw at pacaids.com
Fri Sep 21 00:34:45 PDT 2001


If you want to do it from a shell script with a 'ps | grep' thing, the 
command line would be as such:

-----
[iamgod at myserver]$ ps -ax |grep named
warning: `-' deprecated; use `ps ax', not `ps -ax'
397	?	S	30:31	named
23765	p2	R	0:00	grep named
[iamgod at myserver]$
-----

If it returns more than one (or two depending on your version of ps) lines, 
your server is up.  Be aware that the command line options vary depending 
on your distribution.  This is the version that comes with the Cobalt Linux 
boxes, which is very similar to Red Hat.  The '-' isn't necessary for most 
new versions of 'ps'.  I believe 'wc' does line counting, that'll give you 
a numerical form for your shell script to parse.

To test by hand run nslookup..
-----
[iamgod at myworkstation]$ nslookup
Default Server:  dns.isp.com
> server mydns.foobar.com
Default Server: mydns.foobar.com
Address:  100.200.100.200

> exit
[iamgod at myworkstation]$
-----

I hope I made sense.  :)  Have fun!

- Christopher Wagner
--
<chrisw at pacaids.com>
IS Administrator - Packaging Aids Corporation
San Rafael, CA
415-454-4868 x116
http://www.pacaids.com/


-----Original Message-----
From:	linmail [SMTP:linmail at itab.com]
Sent:	Thursday, September 20, 2001 6:54 PM
To:	linux mail
Subject:	How do you ask your nameserver is he's up or not


What's the right way to test if the nameserver's up?

I did a thing that checked if the pid file existed but the name server
crashed and the pid file was still there. There must be some ping this port
or ps | grep thing or what.

I know, I know, reinstall bind. But until then I playing with shell 
scripts.

On another subject; do this:

whois apple.com

what's up with that HUH? terrorists.apple.com????

I email JIMPHILLIPS.ORG but haven't heard anything yet.



More information about the talk mailing list