Click to See Complete Forum and Search --> : [RESOLVED] Shell script does nothing.


Kudose
03-04-2006, 06:23 AM
Hello everyone. I am trying to get BIND 9.x.x to work on my RH9 box. I got the tarball and extracted and moved everything where it needed to be. Made the appropriate zone files and named.conf

Turns out the tar didnt come with the /etc/rc.d/init.d/named file. So I had to make one from a site a I found:

#!/bin/sh
#
# named This shell script takes care of starting and stopping
# named (BIND DNS server).
#
# chkconfig: - 55 45
# description: named (BIND) is a Domain Name Server (DNS) \
# that is used to resolve host names to IP addresses.
# probe: true

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/named ] || exit 0

[ -f /etc/named.conf ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
start)
# Start daemons.
echo -n "Starting named: "
daemon named
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/named
echo
;;
stop)
# Stop daemons.
echo -n "Shutting down named: "
killproc named
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named
echo
;;
status)
/usr/sbin/ndc status
exit $?
;;
restart)
$0 stop
$0 start
;;
reload)
/usr/sbin/ndc reload
exit $?
;;
probe)
# named knows how to reload intelligently; we don't want linuxconf
# to offer to restart every time
/usr/sbin/ndc reload >/dev/null 2>&1 || echo start
exit 0
;;

*)
echo "Usage: named {start|stop|status|restart}"
exit 1
esac

exit $RETVAL





After running dos2unix on it and changing the permissions and setting the file to be executable.

I get this:

[root@ns1 /]# /etc/rc.d/init.d/named start
[root@ns1 /]#

That's all. Nothing to tell me anything happened. Anyone know why?

TIA.

rbblue8
03-06-2006, 08:50 AM
funny how you are talking aboiut dns server when this is a php site. I honestly do not see how they are related.

2nd.. Read about bind before you get involved with it. Know your server back and from before evan plugging it in to the network. Peopel do not do not this.... well they just open there server up to lots of bad "stuff".

3rd. When i start my bind script from the command line such as you did.. it does exactly what you got. If there was an error... you would have gotten one. If you did your config file corectly... then your server should be up and running. do a netstat -nl and see if port DNS is open (it will auctally say localhost:DNS). Then from a nother puter do a nslookup server (your servers ip) and then try a web url.. and see what ya get.

4) Why would you run dos2unix? My god.. you are running unix for a reason.. Once again... read #2 again.


good luck to you.

Kudose
03-06-2006, 04:07 PM
Alright ... I am a nice guy, but mean questions get mean aswers.

1. This is a PHP site, but did you read the Forum I posted in ... Echo Lounge == General Chat.

2. Excuse me for trying to manually install BIND instead of going the easy route of an RPM package.

3. The problem was that it placed the named file in a different directory, so the sheel script did what it was supposed to do -- return 0 immediately -- with no errors.

4. I edited the named.conf in windows, so I needed to use dos2unix on the file to take out the hidden characters.

I suppose those weren't really mean answers ... in any case, you seem like you have a little knowledge, but bad people skills.

You might want to work on that.

dalecosp
03-06-2006, 10:36 PM
So, it works, or not? The problem was

Over in BSDland, if the script returned immediately and I had no clue if it worked or not, I'd check for the process (something like `ps -aux | grep name` or `pgrep named`) or I'd check for something listening on port #53 (`netstat -anf inet | grep 53`) ... or I'd play with dig or nslookup against the localhost.

But then, I'm used to flint knives and bearskins....

:D

Kudose
03-07-2006, 07:10 AM
Yep. It all works now. Thanks.