LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-14-2007, 01:35 AM   #1
manitabh
LQ Newbie
 
Registered: Nov 2007
Location: Bangalore, India
Posts: 16

Rep: Reputation: 0
rc.d help


I am trying to configure /etc/rc.d/init.d/named..
I have written the script and made a file /var/run/named/named.pid.
After that I have created a user named and set permission like "chown named.named /var/run/named/".
Then I run chkconfig --add named
Now when I restart the system I don't find /var/run/named/named.pid file.
Again when I try to start named by /etc/rc.d/init.d/named start it gives me failed message. My rndc is conigured properly.
 
Old 11-14-2007, 03:02 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
I have written the script and made a file /var/run/named/named.pid.
You shouldn't create the pid file. It will be created once named is up and running.
Quote:
Again when I try to start named by /etc/rc.d/init.d/named start it gives me failed message
Check the logs under /var/log to find out what the problem is.
 
Old 11-14-2007, 03:08 AM   #3
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Rep: Reputation: 30
Usually, any exit code of non zero indicates an error.

How are you "exit"ing your script? are you setting up something like "RETVAL" and "exit $RETVAL".
 
Old 11-14-2007, 03:21 AM   #4
manitabh
LQ Newbie
 
Registered: Nov 2007
Location: Bangalore, India
Posts: 16

Original Poster
Rep: Reputation: 0
My script is like this
-------------------------------
#!/bin/sh
#
# named This shell script takes care of starting and stopping
# named (BIND DNS server).
#
# chkconfig: 345 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/local/sbin/named ] || exit 0
[ -f /etc/named.conf ] || exit 0
#
# See how we were called.
case "$1" in
start)
# Start daemons.
echo -n "Starting named: "
daemon /usr/local/sbin/named -u named -c /etc/named.conf
echo
touch /var/lock/subsys/named
;;

stop)
# Stop daemons.
echo -n "Shutting down named: "
kill `pidof named`
echo
rm -f /var/lock/subsys/named
;;

status)
status named
exit $?
;;

restart)
$0 stop
$0 start
exit $?
;;

reload)
/usr/local/sbin/rndc reload
exit $?
;;

probe)
# named knows how to reload intelligently; we don't want linuxconf
# to offer to restart every time
/usr/local/sbin/rndc reload >/dev/null 2>&1 || echo start
exit 0
;;
#

*)
echo "Usage: named {start|stop|status|restart|reload}"
exit 1
esac
#
exit 0
 
Old 11-14-2007, 03:41 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you run "/usr/local/sbin/named -u named -c /etc/named.conf" manually, does it start?
 
Old 11-14-2007, 05:48 AM   #6
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Rep: Reputation: 30
Quote:
Originally Posted by jschiwal View Post
If you run "/usr/local/sbin/named -u named -c /etc/named.conf" manually, does it start?
yes, and what is the return code ($?) from daemon.

also, your start and stop functions don't return any codes and your probe function always succeeds, apparently, it returns 0, always.
 
Old 11-14-2007, 11:11 PM   #7
manitabh
LQ Newbie
 
Registered: Nov 2007
Location: Bangalore, India
Posts: 16

Original Poster
Rep: Reputation: 0
No it does not start
 
Old 11-16-2007, 11:14 AM   #8
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Rep: Reputation: 30
whats in the logs (/var/log/???)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration