Operating System - HP-UX
1752793 Members
6038 Online
108789 Solutions
New Discussion юеВ

Re: Run script when bootup

 
SOLVED
Go to solution
juno2
Super Advisor

Run script when bootup

I want to run a script to start the db when the UX is bootup , how to set it in HP UX 11.0 ? Thx
10 REPLIES 10
Rainer von Bongartz
Honored Contributor

Re: Run script when bootup


put your script in /sbin/init.d

i.e. /sbin/init.d/dbstartup


an then make a symbolic link from /sbin/rc2.d


/sbin/rc2.d/S570dbstartup -> /sbin/init.d/dbstartup


This will startup the database whenever the system enters run-level 2.

Regards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
melvyn burnard
Honored Contributor

Re: Run script when bootup

Take a read of the document in:
/usr/share/doc called start_up.txt
this should explain it all for you.
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
twang
Honored Contributor

Re: Run script when bootup

Configure a script to autorun at system bootup:

1. copy and create script on /sbin/init.d (from /sbin/init.d/template)

2. Create symbolic links to the script in the appropriate run-level script directories, as follows:

# ln -s /sbin/init.d/script_name /etc/rc0.d/K10script_name
# ln -s /sbin/init.d/script_name /etc/rc3.d/S99scipt_name

Re: Run script when bootup

If dbstart and dbstop are the scripts that start or stop the database, then you can create a small script like this:

#!/usr/bin/sh
#
#export all the path variables you want
#
#
case "$1" in

"start_msg") echo "Starting Oracle dababase" ;;

"start") /path/to/script/dbstart ;;
"stop_msg") echo "Stoping oracle database" ;;
"stop") /path/to/script/dbstop ;;

*) echo "Usage: myscript start | stop" ;;

esac

exit 0

Name the script something (myscript here) and put it in /sbin/init.d directory with 555 permisions.

Go to /sbin/rc3.d if you want it to start on runlevel 3 and make a softlink to the above script named S999oracledb for example. The S means that the script should start in this runlevel. The number is the sequence of executing the scripts.

To have the database shutdown automatically when you rebbot or shuting the system down, make a softlink to the script in /sbin/rc2.d or rc1.d and name it Kxxxoracledb. K stands for kill or stop. xxx is again the sequence. Make sure you run it (and stop the database) BEFORE other important things stop running.

hope it helps,

Nikos
twang
Honored Contributor

Re: Run script when bootup

A script should like this:
#!/bin/ksh

case "$1" in

start_msg)
echo "run startup_script"
;;
start)
(add startup script here)
;;
stop_msg)
echo "run shutdown_script"
;;
stop)
(add shutdown script here)
;;
esac
Tom Geudens
Honored Contributor

Re: Run script when bootup

Hi,
This question was answered fully (scripts inclusive) in http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x3ce99276484dd611abdb0090277a778c,00.html

My search was : "oracle sbin"

Regards,
Tom Geudens
A life ? Cool ! Where can I download one of those from ?
juno2
Super Advisor

Re: Run script when bootup

thx all reply,

but what is the meaning of the code "S570" in Rainer von Bongartz 's example , in my system , there are some other codes like S900 , S780 , what code should i use ? thx
twang
Honored Contributor

Re: Run script when bootup

 
Robert Salter
Respected Contributor

Re: Run script when bootup

The "S" means it is a start script, a "K" means it is a stop script. When your system boots up it will run all the "S" scripts (sometimes dependent on flags set in /etc/rc.config.d files)at particular run levels, hence the rc2.d, rc3.d, etc... directories. The "K" scripts do the opposite, as the system goes thru the run levels to shutdown it will run the "K" scripts to stop processes, apps, or daemons. The numbers next to the "S" and "K" are the sequence they run in.

Like the folks earlier stated it's all in /usr/share/start_up.txt

Later
Time to smoke and joke