Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripts from rc0.d 1

Status
Not open for further replies.

tomecki24

Programmer
Jun 13, 2001
52
DE
Hello,

I've got a question.
When I reboot the Solaris 7 machine with command "reboot", are there run scripts from rc0.d?
If not, where should I place the scripts to be run, when system reboots.

Thanks
Tomasz
 
Hi Tomasz,

rc0.d is generally used for scripts to be run when the machine is shutting down. I would suggest placing your scripts, or links to them, in /etc/rc2.d, so that they are picked up as the box reboots.

Cheers
 
hello,

ok.
So if I correctly understood, I should put starting script in rc3.d directory and stopping script in rc2.d? When system reboots, it would stop my scripts.
And when I call "shutdown", the script from rc2.d will be executed?

Thanks a lot
Tomasz
 
I think we've got slightly crossed wires here. Basically the scripts beginning with S (capital) in rc2.d and rc3.d are those which get executed when the machine is booting up to multi-user mode. The order in which they are executed is dependant on the number assigned to them (eg S81file would be executed before S99file).

Those files in rc0.d, rc2.d and rc3.d beginning with a K are those which are executed as the machine shuts down - again with the priority being determined by the number assigned to them.

Hope this helps, I know it can be a bit baffling!
 
Here is the structure you will commonly find :
Write a script which will accept one parameter (start or stop) .
Place taht script in /etc/init.d directory
make a HARD link to that file from rc0.d and rc2.d or rc3.d.
The link will start with K?????? in the rc0.d and with S?????? in the rc2.d or rc3.d.


If you look in the specified directories, you will find plenty of examples.
 
hello,

yes, of course.
I will tell You my whole problem, to get clear situation.
I've got a script, which starts oracle db instance and starts a program which uses this instance - this script is linked to file /etc/rc3.d/S99startserver. I'm wondering where should I put /etc/rc???/K99stopserver script. I would like to stop program and oracle db instance when system is rebooted or "shutdowned". I've done one time reboot without closing oracle but it was not good idea :)

Thank You very much
Tomasz
 
Hi,

that's the ticket. For our purposes we have a file K10dbora (linked to a dbora script in /etc/init.d with the stop option) in the rc0.d directory, so this is executed as the machine shuts down. As you say, Oracle isn't a great fan of unscheduled halts! Good luck.
 
hello,

So it's better to shutdown system instead of reboot it?
Because when system is shutdown, scripts from rc0.d are called with "stop" option and during reboot none of the scripts is called.
But when I shutdown the system, it goes to state S. How can I bring it back into state 3?

Thanks
Tomasz
 
You can pass the init state that you want to "shutdown" or "init".
do a man on shutdown and init to find out what the init states are.

ex : to get back to state 3 :
shutdown -y -i 3

Also you can look at the file /etc/inittab for your default boot state on the line initdefault
 
Alternatively, if you just want to reboot the machine, issue a shutdown -i6 -y -g0 command to effectively 'bounce' the box. Any startup scripts in rc2.d etc will be picked up as part of this process, and should include your Oracle startup ones as well, assuming you do want Oracle restarted automatically. HTH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top