LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-06-2006, 08:18 PM   #1
muusle
LQ Newbie
 
Registered: Sep 2005
Distribution: Slackware 10.2
Posts: 10

Rep: Reputation: 0
Question Don't start automatically at boot, just directly


Iím sure this is a quick one, although itís rather strange oneÖ

You know the idea of making a script executable for the purpose of starting things at boot:

Quote:
Code:
# To make dhcpd start automatically at boot, make this
# file executable: chmod 755 /etc/rc.d/rc.dhcpd
Well, attempting to start my dhcp server on boot with this method doesnít start the dhcp server at all, no error message, nothing!

But executing the script directly likes this

Code:
/etc/rc.d/rc.dhcpd start
The dhcp server starts up just fine.

Suggestions?

Dump of the /etc/rc.d/rc.dhcpd

Code:
#!/bin/sh
#
# /etc/rc.d/rc.dhcpd
#
# Start/stop/restart the DHCP daemon.
#
# To make dhcpd start automatically at boot, make this
# file executable: chmod 755 /etc/rc.d/rc.dhcpd
#
#############################################

CONFIGFILE="/etc/dhcpd.conf"
LEASEFILE="/var/state/dhcp/dhcpd.leases"
INTERFACES="eth1"
OPTIONS="-q"

#############################################

dhcpd_start() {
if [ -x /usr/sbin/dhcpd -a -r $CONFIGFILE ]; then
echo "Starting DHCPD..."
/usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES
# /usr/sbin/dhcpd -q $INTERFACES
fi
}

dhcpd_stop() {
killall dhcpd
}

dhcpd_restart() {
dhcpd_stop
sleep 2
dhcpd_start
}

case "$1" in
'start')
dhcpd_start
;;
'stop')
dhcpd_stop
;;
'restart')
dhcpd_restart
;;
*)
# Default is "start", for backwards compatibility with previous
# Slackware versions. This may change to a 'usage' error someday.
dhcpd_start
esac
 
Old 04-06-2006, 08:29 PM   #2
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
Add a call to this script in /etc/rc.d/rc.local. It'll work, I swear
 
Old 04-06-2006, 08:39 PM   #3
muusle
LQ Newbie
 
Registered: Sep 2005
Distribution: Slackware 10.2
Posts: 10

Original Poster
Rep: Reputation: 0
Well, look at thatÖ Works like a charmÖ

Thanks mdarby!
 
Old 04-06-2006, 08:54 PM   #4
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
But of course. Pretty much anything you want to start at boot should be referenced in rc.local.
 
Old 04-06-2006, 11:50 PM   #5
hdpei
LQ Newbie
 
Registered: Mar 2006
Posts: 1

Rep: Reputation: 0
in the terminal
ls -al ,look at the rc.dhcpd is whether exec...
chmod +x ...

Last edited by hdpei; 04-06-2006 at 11:52 PM.
 
Old 04-07-2006, 12:24 AM   #6
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 54
Quote:
Originally Posted by mdarby
But of course. Pretty much anything you want to start at boot should be referenced in rc.local.
Matt, would he be better off putting that in rc.inet1? If he has anything that needs his dhcp daemon starts before rc.local invokes his scripts, the network will still be offline.

BTW to the OP, you don't need to run DHCP daemon if you just want to use DHCP to connect to the internet.....for that you just use the DHCP client, which gets invoked from rc.inet1

Sorry if I am saying the obvious here...
 
Old 04-07-2006, 05:06 AM   #7
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
You can do this to check if any script starts your dhcpd server:
$ cat /etc/rc.d/*|grep dhcpd|most
I'm 99% sure you won't find a line similar to this:
Code:
if [ -x /etc/rc.d/rc.dhcpd ]; then
  . /etc/rc.d/rc.dhcpd start
fi
I would put this in the beginning of rc.M after syslog start script. But that's only I.

Last edited by Alien_Hominid; 04-07-2006 at 05:08 AM.
 
Old 04-07-2006, 08:56 AM   #8
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
Quote:
Originally Posted by Randux
Matt, would he be better off putting that in rc.inet1? If he has anything that needs his dhcp daemon starts before rc.local invokes his scripts, the network will still be offline.

Sorry if I am saying the obvious here...
The dhcp daemon is for serving other systems on the network. Any machine hosting a DHCP server should have a static IP to begin with.

I have a few scripts in my rc.local that start a network bridge, OpenVPN and then my DHCP server with no issues at all. Addresses are handed out via the br0 interface (a virtual bridge between tap0 and eth0). All works perfectly.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How do I start dhclient automatically at boot-up? moonmoth Linux - Networking 4 07-17-2005 04:15 AM
How can mySQL start automatically on boot ? John_Emad Linux - Software 6 06-24-2005 12:33 PM
dhcp won't start automatically on boot blk96gt Slackware 5 01-24-2005 01:42 PM
How do I start programs automatically with boot up? Kasperisa Linux - Newbie 6 07-15-2004 03:29 PM
How to start programs automatically at boot? onchiman Linux - Hardware 2 03-18-2003 10:19 AM


All times are GMT -5. The time now is 09:22 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration