1829930 Members
2234 Online
109998 Solutions
New Discussion

Startup location

 
SOLVED
Go to solution
Chi Yi Lee
Advisor

Startup location

Hi
I made a script and planning to launch it when the system boot. Do I put the script in /sbin/init.d?
Do I need to edit somewhere?

thanks
9 REPLIES 9
jpcast_real
Regular Advisor

Re: Startup location

Hello,

In /sbin/init.d you just place the startup or shutdown script , but you must tell the system how and when to use it .

You will tell the system to start the script in a certain execution level . This is defined in the /sbin/rcX.d . X means the execution level in which the script will be executed

In this directories you will create a file for the startup , SXXX..... , and a file for the shutdown KXX.... XXX means the order in which the scripts will be executed inside the execution level.

There are a lot of examples in this directories



XXX means the orede
Here rests one who was not what he wanted and didn't want what he was
Joseph Loo
Honored Contributor

Re: Startup location

hi,

read this post:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=106875

besides /sbin/init.d where the script r kept, u need to do a soft link to /sbin/rc#.d as well.

regards.
what you do not see does not mean you should not believe
Naveej.K.A
Honored Contributor

Re: Startup location

hi,

Adding a program to start automatically at run time requires that the program be put in /sbin/init.d directory.
the execution scripts contains four major parts which are passed as command line arguments to these scripts.

start_msg displayed on the console when starting
stop_msg displayed on the console when stopping
start command to start the program
stop command to stop the program

and these are put in the configuration for each respective script at /etc/rc.config.d directory

next you need to decide at which run level you are going to start the script, say you are planning to start the script at run level 2. a link file has to be placed in /sbin/rc2.d directory.

ln -s /sbin/init.d/script /sbin/rc2.d/S900script

with best wishes
Naveej
practice makes a man perfect!!!
Chi Yi Lee
Advisor

Re: Startup location

Thanks Javier

One more Q.
It seems like in /sbin/rcX.d are bunch of links. Is that mean that I don't have to put my script in /sbin/init.d?
Elmar P. Kolkman
Honored Contributor

Re: Startup location

No... /sbin/init.d should contain the script, /sbin/rc#.d should contain symbolic links to that script.
Every problem has at least one solution. Only some solutions are harder to find.
Rajesh D L
Frequent Advisor

Re: Startup location

Hi,

You must put your script in /sbin/init.d and create the link to /sbin/rcX.d directory.

regards,
RDL.
Sanjay Kumar Suri
Honored Contributor

Re: Startup location

Script has to be kept in /sbin/init.d directory whereas files under /sbin/rc?.d are links to the script in /sbin/init.d.

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Yogeeraj_1
Honored Contributor

Re: Startup location

hi,

this is an example for what we do typically for Oracle Database startup:

Relevant Files:
===============
a. /sbin/init.d/oracle
contains the main script for doing db startup and shutdown owned by root

b. /etc/rc.config.d/oracle
this file enables/disables automatic startup and shutdown of the databases owned by root

c. /sbin/rc1.d/K100oracle ->/sbin/init.d/oracle
this link tells the system when to execute the Oracle script with the 'stop' command in single user mode during system shutdown

d. /sbin/rc2.d/S990oracle ->/sbin/init.d/oracle
this link tells the system when to execute the Oracle script with the 'start' command in multi-user mode during system startup

Steps:
======
1. Create an executable script /sbin/init.d/oracle for the startup and shutdown of Oracle

Your script should attempt to start the database with the following command:
su - -c <$ORACLE_HOME>/bin/dbstart

Your script should attempt to shut the database with the following command:
su - -c <$ORACLE_HOME>/bin/dbshut

Make sure that the script is owned and executable only by the super user.

2. Create the file /etc/rc.config.d/oracle
This file should contain:
ORACLE_START=1
export ORACLE_START

3. Edit /etc/oratab
ORACLE_SID:ORACLE_HOME:Y|N

where Y or N indicates whether you want the dbstart and dbshut scripts to be run

4. Make /sbin/rc1.d/K100oracle a symbolic link to /sbin/init.d/oracle

5. Make /sbin/rc2.d/S990oracle a symbolic link to /sbin/init.d/oracle

hope this helps!
regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)