cancel
Showing results for 
Search instead for 
Did you mean: 

RC0 scripts.

SOLVED
Go to solution
socar_1
Occasional Contributor

RC0 scripts.

I have oracle shutdown script in rc0.d as K18oracle. If I run this script from command line "./K18oracle stop" oracle was cleanly shutdown. When I shutdown the machine with command "shutdown -r now" oracle processes was killed. Why ?
Thenks.
3 REPLIES
Ivan Ferreira
Honored Contributor

Re: RC0 scripts.

I read once that using the shutdown command does not call the script, don't know why. Use the init 0 command to shutdown the system and the script will work.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Ivan Ferreira
Honored Contributor
Solution

Re: RC0 scripts.

You can also try the -s option of the shutdown command.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Kris Smith
Advisor

Re: RC0 scripts.

Socar,

The shutdown command does not run through the rc0 scripts as described in the man pages for shutdown under the description for the -h and -r flags. You should try to run the #init 0 command and see what happens there. This is the most likely answer. If not, check these items below:
-----------------------------------------
The inittab man page explains that the K* entries in the inittab refer to links in /sbin/rc0.d directory. If it is still being killed instead of stopped, there is likely an error in the link or you may need to reference the complete path (instead of a relative path as above).
One possible error, though you are likely aware of this, is the additional 'stop' parameter. If you run #cat /sbin/rc0 you will find that this script loops through all of the K* entries in rc0.d and runs them with a stop command. This script uses the command '/sbin/sh $f stop', where $f is any of the K* entries in rc0.d. Since there is already a stop parameter, your stop parameter is needed at the command line but not at the inittab entry.
Lastly, notice that the rc0 script runs the stop scripts (K*) under the Bourne shell (/sbin/sh). What is the shell you are under when running the script from the command line? Is it the same? Are you the root user? If you are running the command as your own user, you may have different path variables that are not included when you su- to root.

I hope some of this helped. Good luck.
Regards,
Kris