LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-16-2004, 10:41 PM   #1
kola
Member
 
Registered: Jul 2004
Location: Christchurch, New Zealand
Distribution: FC2, Debian 'Sarge'
Posts: 64

Rep: Reputation: 15
starting dnsmasq at boot


Can anynone tell me how to do this in Redhat 7.3 please? Im a little confused about which start script/directory i should be using for this?

thanks
 
Old 07-16-2004, 11:26 PM   #2
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi Kola,
The script must be installed in the "/etc/rc.d/init.d" directory. After this, you must add it to the boot procedure with the command "chkconfig --add dnsmasq", if it is the name of the script. If you don't have the script, here goes one I use
Code:
#!/bin/sh
#
# Startup script for the DNS caching server
#
# chkconfig: 2345 99 01
# description: This script starts your DNS caching server
# processname: dnsmasq
# pidfile: /var/run/dnsmasq.pid

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

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

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

dnsmasq=/usr/local/sbin/dnsmasq
[ -f $dnsmasq ] || exit 0

# change this line if you want dnsmasq to serve an MX record for
# the host it is running on.
MAILHOSTNAME=""
# change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
RESOLV_CONF="/etc/ppp/resolv.conf"
# change this if you want dnsmasq to cache any "hostname" or "client-hostname" from
# a dhcpd's lease file
DHCP_LEASE="/var/state/dhcp/dhcpd.leases"
DOMAIN_SUFFIX=`dnsdomainname`

OPTIONS=""

if [ ! -z "${MAILHOSTNAME}" ]; then
  OPTIONS="$OPTIONS -m $MAILHOSTNAME"
fi

if [ ! -z "${RESOLV_CONF}" ]; then
  OPTIONS="$OPTIONS -r $RESOLV_CONF"
fi

if [ ! -z "${DHCP_LEASE}" ]; then
  OPTIONS="$OPTIONS -l $DHCP_LEASE"
fi

if [ ! -z "${DOMAIN_SUFFIX}" ]; then
  OPTIONS="$OPTIONS -s $DOMAIN_SUFFIX"
fi

RETVAL=0

# See how we were called.
case "$1" in
  start)
        echo -n "Starting dnsmasq: "
        daemon $dnsmasq $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dnsmasq
        ;;
  stop)
        if test "x`pidof dnsmasq`" != x; then
            echo -n "Shutting down dnsmasq: "
            killproc dnsmasq
        fi
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dnsmasq /var/run/dnsmasq.pid
        ;;
  status)
        status dnsmasq
        RETVAL=$?
        ;;
  restart|reload)
        $0 stop
        $0 start
        RETVAL=$?
        ;;
  condrestart)
            if test "x`/sbin/pidof dnsmasq`" != x; then
                $0 stop
                $0 start
                RETVAL=$?
            fi
            ;;
  *)
        echo "Usage: $0 {start|stop|restart|reload|condrestart|status}"
        exit 1
esac

exit $RETVAL
 
Old 07-16-2004, 11:49 PM   #3
kola
Member
 
Registered: Jul 2004
Location: Christchurch, New Zealand
Distribution: FC2, Debian 'Sarge'
Posts: 64

Original Poster
Rep: Reputation: 15
Thanks, that looks good. I saved that script and just changed the options on it a little.

Seems to execute ok, hopefully it will work when i reboot the machine.

Could you tell me what the difference between files in /etc/init.d/ and /etc/rc.d/init.d/ is?

-- lee
 
Old 07-17-2004, 02:05 AM   #4
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
/etc/init.d is a link to /etc/rc.d/init.d.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
dnsmasq can't work ultrax Linux - Networking 1 08-05-2005 09:06 PM
dnsmasq.conf exvor Linux - Software 2 06-24-2005 05:28 PM
Won't Boot - Starting Printer Service - Starting CUPS jeansond Linux - Newbie 0 10-11-2004 06:39 PM
dnsmasq startup bardinjw Linux - Networking 2 07-19-2003 03:36 AM
Dnsmasq dunkyb Linux - Software 0 03-16-2003 02:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:36 PM.

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