openSUSE Forums > Archives > SLS Archives > ARCHIVES - SuSE Linux > ARCHIVES - Network & Security » Dhcrelay Started From /etc/init.d Script At Boot

Go Back   openSUSE Forums > Archives > SLS Archives > ARCHIVES - SuSE Linux > ARCHIVES - Network & Security
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Network & Security Any network and / or security related questions should be posted in here.

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-Apr-2008, 02:48
pdon
Guest
 
Posts: n/a
Default

In a SuSe Linux 10.2 box, I use dhcrelay (DHCP relay agent).

dhcrelay should run all the time, so I put /etc/init.d/dhcrelay start
in a shell script in /etc/init.d/boot.dhcrelay
(and a soft link /etc/init.d/boot.d/S90boot.dhcrelay to that)

After a reboot, dhcrelay is running in background as can be seen from
a ps -ef command
/usr/sbin/dhcrelay -i eth1 -i eth2 AAA.BBB.CCC.DDD
(AAA... is IP of my DHCP server)
except that ... DHCP requests ARE NOT RELAYED ...

But if I manually do, at the root prompt
# /etc/init.d/dhcrelay stop
# /etc/init.d/dhcrelay start

then DHCP requests are being relayed...

Why does is not work when started from a script at boot time ??
  #2 (permalink)  
Old 07-Apr-2008, 03:47
hcvv
Guest
 
Posts: n/a
Default

I can not determine from your information at what runlevel dhcrelay should run. IMHO it should run from runlevel 3 (network) upwards. When it is already started at a lower runlevel (e.g. immediately after boot) your network interface is not up. This might explain why it works later (when done manually).

This is only a guess.
  #3 (permalink)  
Old 07-Apr-2008, 04:42
hcvv
Guest
 
Posts: n/a
Default

As suggstion I may further add that links like S90... should not go into /etc/init.d but in one or more of the /etc/init.d/rc?.d directories.

More info is in /etc/init.d/README and in man insserv.

Also note that YaST can be helpful here when you put a section like
Code:
### BEGIN INIT INFO
# Provides: dhcrelay
# Required-Start: $local_fs $syslog $network
# Required-Stop: $local_fs $syslog $network
# X-UnitedLinux-Should-Start: dhcrelay
# Default-Start:**3 5
# Default-Stop:** 0 1 2 6
# Description:****Start the DHCP relay agent
### END INIT INFO
in the beginning of the script (look at the other scripts in /etc/sbin.d). More about this in /etc/init.d/skeleton.

Gives you a lot to read
  #4 (permalink)  
Old 08-Apr-2008, 03:39
pdon
Guest
 
Posts: n/a
Default

It seems writing your own scripts to be started at boot in SuSE linux (10.2) is far
more strict and formalized than in other unices, where either you have a /etc/init.d/local
script already where you can put things in or just make your own shell script and provide
the necessary soft links in /etc/init.d/rc5.d ...

Anyway, for this dhcrelay case, just setting the appropriate soft links in /etc/init.d/rc5.d
should do the job (/etc/init.d/dhcrelay already exists)
(putting them in rc3.d was not good for this system (not executed..) because the default
run level (as specified in /etc/inittab) is 5 and not 3, scripts in rc3.d are ignored :-) )


If one does want to install a script enterily of one's own, is there any tutorial
how to do this step by step ? Can't find that in the OpenSUSE reference manual ..

Quote:
As suggstion I may further add that links like S90... should not go into /etc/init.d but in one or more of the /etc/init.d/rc?.d directories.

More info is in /etc/init.d/README and in man insserv.

Also note that YaST can be helpful here when you put a section like
Code:
### BEGIN INIT INFO
# Provides: dhcrelay
# Required-Start: $local_fs $syslog $network
# Required-Stop: $local_fs $syslog $network
# X-UnitedLinux-Should-Start: dhcrelay
# Default-Start:**3 5
# Default-Stop:** 0 1 2 6
# Description:****Start the DHCP relay agent
### END INIT INFO
in the beginning of the script (look at the other scripts in /etc/sbin.d). More about this in /etc/init.d/skeleton.

Gives you a lot to read
[/b]
  #5 (permalink)  
Old 08-Apr-2008, 04:23
hcvv
Guest
 
Posts: n/a
Default

Quote:
It seems writing your own scripts to be started at boot in SuSE linux (10.2) is far
more strict and formalized than in other unices, where either you have a /etc/init.d/local
script already where you can put things in or just make your own shell script and provide
the necessary soft links in /etc/init.d/rc5.d ...
[/b]
Ther is a boot.local (and a halt.local) but that runs immediately after boot (runlevel 1?). I do not know at what level local you mention in other unices run, there must be one for every level then.

Yes, making your own scripts and the links will work, but in your original post you said you made a link in /etc/init.d/ which should be in /etc/init.d/rc5.d/

Quote:
Anyway, for this dhcrelay case, just setting the appropriate soft links in /etc/init.d/rc5.d
should do the job (/etc/init.d/dhcrelay already exists)
(putting them in rc3.d was not good for this system (not executed..) because the default
run level (as specified in /etc/inittab) is 5 and not 3, scripts in rc3.d are ignored :-) )
[/b]
You should decide at what level(s) it should run and then make links in either rc5.d or (rc3.d and rc5.d).
The behaviour is different in different unices also.
Some start things from a lower level when a higher level is to be reached (like stepping upwards through the levels adding more starts at every level). Some stop things not mentioned in a level and start only things mentioned in that level (e.g. HP-UX vs. Solaris).

Quote:
If one does want to install a script enterily of one's own, is there any tutorial
how to do this step by step ? Can't find that in the OpenSUSE reference manual ..
[/b]
Well, I gave you a lot of stuff to read. Are you still missing something?
The '### BEGIN INIT INFO' stuff is only there to tell YaST what to do so YaST can present a nice and easy interface to the GUI user. But you can do it all by hand as you say above.

BUT it is not clear to me if, now you have the link in the correct place, everything works or not.
  #6 (permalink)  
Old 08-Apr-2008, 06:49
pdon
Guest
 
Posts: n/a
Default

Everything works OK now..

In fact, how to do it is well described in the SuSE 10.2 PDF manual chapter "Booting and
Configuring a Linux System".

But that /etc/init.d/README file refered to a chapter entitled 'The SUSE boot concept' but there is
no such chapter title in the 700 pp 10.2 PDF (-- there is even nowhere a string 'boot concept' !)
:angry:

.. which left me guessing for a while.. Anyway this trial and error learned me more how it
organized in SuSe Linux.

Enabling/disabling services can be done via the graphical Yast interface - it creates all
the necessary soft-links for you at the right places..

Thanks for your hints..

Quote:
Ther is a boot.local (and a halt.local) but that runs immediately after boot (runlevel 1?). I do not know at what level local you mention in other unices run, there must be one for every level then.

Yes, making your own scripts and the links will work, but in your original post you said you made a link in /etc/init.d/ which should be in /etc/init.d/rc5.d/
You should decide at what level(s) it should run and then make links in either rc5.d or (rc3.d and rc5.d).
The behaviour is different in different unices also.
Some start things from a lower level when a higher level is to be reached (like stepping upwards through the levels adding more starts at every level). Some stop things not mentioned in a level and start only things mentioned in that level (e.g. HP-UX vs. Solaris).
Well, I gave you a lot of stuff to read. Are you still missing something?
The '### BEGIN INIT INFO' stuff is only there to tell YaST what to do so YaST can present a nice and easy interface to the GUI user. But you can do it all by hand as you say above.

BUT it is not clear to me if, now you have the link in the correct place, everything works or not.
[/b]
 

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2