"Konstantin (Kastus) Shchuka" wrote:
On Sun, Apr 15, 2001 at 04:05:48PM -0700, Rhugga wrote:
You can actually place the script anywhere, just create a symbolic link withan uppercase 'S' or 'K' and the appropriate number. You can call the link whatever you like.
ex: You have a script called apache in /root.
cd /etc/init.d/rc3.d ln -s /root/apache S80start_web_server cd /etc/init.d/rc1.d ln -s /root/apache K50stop_web_server
/root/apache must be executable and owned by root.
However, ideally, scripts are placed in /etc/init.d and symbolically linked from the appropriate run level directory. It is also good practice to name the symbolic link the same as the script, ie: S80apache. You also need to look when other services are stopped/started and decide on a logical place in the sequence to start/stop your process. There is no need to start a web server before you interfaces and routing have been configured..
On a sidenote, to disable something from starting/stopping automatically, rename the link to a lower case 's' or 'k' so you can always reference where it used to be.
Hope this helps, CC
This is correct up till the point SuSEconfig is run. On 7.1 you need to have dependencies discribed in your script. If you have no dependencies, the links to your script will be recreated with wrong numbers.
I learnt it the hard way. I like to have fetchmail running as a daemon. I created a script and placed it in /etc/init.d directory, then created links to start/stop it at appropriate run levels.
It worked great on 6.4. After upgrade to 7.1 my links got recreated by SuSEconfig with wrong numbers. So fetchmail was attempted to start even before starting network!
I then sat and read man page of insserv. It was easy, just add lines to my fetchmail script to describe dependencies.
In my case it is:
### BEGIN INIT INFO # Provides: fetchmail # Required-Start: $network sendmail # Required-Stop: # Default-Start: 2 3 5 # Default-Stop: # Description: Fetchmail as a daemon ### END INIT INFO Then I just run insserv /etc/init.d/fetchmail and proper links are created.
It really worth updating home-grown scripts to include dependency information in them
-Kastus
Got it. I think I like insserv.... -- Mark Hounschell dmarkh@cfl.rr.com