LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Init Scripts (https://www.linuxquestions.org/questions/linux-general-1/init-scripts-507528/)

brazilian_user 12-04-2006 08:28 PM

Init Scripts
 
Hello All!!

I have an Oracle Application server running on my box. I'm creating some scripts to start and stop the Oracle processes automatically when the box is started or turned off.

Basically I put some symbolic links pointing to my scripts in /etc/rc5.d to start the processes. When I turn on the box I can see the processes starting, it's working fine.

I'd like to know what I should do to stop this processes automatically when I restart or turn off the server, and how I can be sure that the scripts are running correctly.

Best Regards

Rodrigo

Oliv' 12-05-2006 04:58 AM

Hello,

well simply do the same as for rc5.d but for rc6.d (reboot) and for rc0.d (halt) except that the symlink should begin by a "K" to tell linux that you want to kill this proccess.

Regards,

Oliv'

brazilian_user 12-05-2006 08:03 AM

Quote:

Originally Posted by Oliv'
Hello,

well simply do the same as for rc5.d but for rc6.d (reboot) and for rc0.d (halt) except that the symlink should begin by a "K" to tell linux that you want to kill this proccess.

Regards,

Oliv'

Hey Oliv, thank you!

I'm gonna do this, but there is another doubt left... How I can be sure that the processes were stopped correctly...?

I'm asking it because When I turn on the machine I can see the start-scripts running, and when the box is up all the processes are running as well, so I'm sure that the start-scripts worked fine.

Since the Oracle Processes can not be stopped unproperly I'd like to know if the stop-scripts worked fine too...

Is there a way I can see if the stop-scripts were all right??

Thank You again!!

Rodrigo

Oliv' 12-05-2006 08:51 AM

Well you can simply do
Code:

command to stop process properly
if [ $? -eq 0 ]
then
  echo "process properly stopped"
else
  do something else
done

You will see the echo line during reboot/halt process in your virtual console.
Another way is to used debian initscript functions like killproc(). To use them simply source /lib/lsb/init-functions file and tou can have a look at this file to know which functions are available and howto use them.

Regards,

Oliv'


All times are GMT -5. The time now is 03:34 PM.