LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Don't start automatically at boot, just directly (https://www.linuxquestions.org/questions/slackware-14/dont-start-automatically-at-boot-just-directly-432513/)

muusle 04-06-2006 08:18 PM

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


mdarby 04-06-2006 08:29 PM

Add a call to this script in /etc/rc.d/rc.local. It'll work, I swear ;)

muusle 04-06-2006 08:39 PM

Well, look at that… Works like a charm…

Thanks mdarby!

mdarby 04-06-2006 08:54 PM

But of course. Pretty much anything you want to start at boot should be referenced in rc.local.

hdpei 04-06-2006 11:50 PM

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

Randux 04-07-2006 12:24 AM

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...:p

Alien_Hominid 04-07-2006 05:06 AM

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.

mdarby 04-07-2006 08:56 AM

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...:p

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.


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