Operating System - HP-UX
1840247 Members
3664 Online
110162 Solutions
New Discussion

startup process after boot

 
Cara Rollins
Advisor

startup process after boot

If I would like to start a process on boot, what directory and file do I add the process to?
i.e. processname environment start
Happiness lies in the joy of acheivement and the thrill of creative effort.
6 REPLIES 6
Indira Aramandla
Honored Contributor

Re: startup process after boot

Hi Cara,

To start a process when the system boots,you have to copy the startup script to /sbin/init.d/ directory and make software links:

For example to start oracle when the system boots and if the script name is dbora)

To start:
ln -s /sbin/init.d/dbora /sbin/rc2.d/S999dbora

To stop:
ln -s /sbin/init.d/dbora /sbin/rc1.d/K108dbora


Depending on which run level you want to start your oracle database, you need to prepare a script and put in /sbin/init.d/.
Then appropriate start and kill scripts in /sbin/rcx.d/

You can refer /sbin/init.d/template script to start with.

And also have the file in /etc/rc.config.d oracle which has the following lines
ORACLE_START=1; export ORACLE_START


IA

Never give up, Keep Trying
James R. Ferguson
Acclaimed Contributor

Re: startup process after boot

Hi Cara:

The "original", definitive whitepaper on this subject appeared during the 9x to 10x rework of HP-UX. It's available on the docs.hp.com website under 10.x and is definitely work reading:

http://docs.hp.com/en/934/startup.pdf

Regards!

...JRF...
Cara Rollins
Advisor

Re: startup process after boot

Okay, here is a sample script. Is this correct?


#!/bin/ksh

/pathname/processname arg1 start

if [ $? = 0 ]
then exit 0
else exit 1
fi


What are the rc1.d and rc2.d processes? I'm assuming the system will read the rc2.d files on startup by default and the rc1.d by default on shutdown. Do I then need to specify start and stop in my script? It's not an oracle script, just a database process called cybermation I have been starting manually from command line after booting. The syntax is processname arg1 start. I'm a little confused here. What is the difference in rc1,2,3 etc?? Can you explain this a little? Thanks for your help.

To start:
ln -s /sbin/init.d/dbora /sbin/rc2.d/S999dbora

To stop:
ln -s /sbin/init.d/dbora /sbin/rc1.d/K108dbora
Happiness lies in the joy of acheivement and the thrill of creative effort.
Indira Aramandla
Honored Contributor

Re: startup process after boot

Hi Cara,

rc1.d and rc2.d⠦⠦.. are Run-level Directories.

The /sbin/rc#.d (where # is a run-level [0..6]) directories are startup and shutdown sequencer directories. They contain only symbolic links to startup/shutdown scripts in /sbin/init.d that are executed by /sbin/rc on transition to a specific run level.

For example, the /sbin/rc3.d directory contains symlinks to scripts that are executed when entering run level 3.

These directories contain two types of link files: start links and kill links. Start links have names beginning with the capital letter â Sâ and are invoked with the â startâ argument at system boot time or on transition to a higher run level. Kill links have names beginning with the capital letter â Kâ and are invoked with the â stopâ argument at system shutdown time, or when moving to a lower run level.

Yes your script should specify the start and stop. The example that I gave dbora is a user defined script where you can have functions defined in the script. One to start and the other to stop. The pdf provided by James RF has more details.


I hope this helps.

IA
Never give up, Keep Trying
Cara Rollins
Advisor

Re: startup process after boot

That helps tremendously. Thank you so much.
Happiness lies in the joy of acheivement and the thrill of creative effort.
Arunvijai_4
Honored Contributor

Re: startup process after boot

Try to assign points to people who helped you here, http://forums1.itrc.hp.com/service/forums/helptips.do?#28

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"