LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 12-04-2006, 08:28 PM   #1
brazilian_user
Member
 
Registered: Nov 2005
Location: Brazil, Po - So Paulo
Distribution: Debian Etch
Posts: 110

Rep: Reputation: 15
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
 
Old 12-05-2006, 04:58 AM   #2
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
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'
 
Old 12-05-2006, 08:03 AM   #3
brazilian_user
Member
 
Registered: Nov 2005
Location: Brazil, Po - So Paulo
Distribution: Debian Etch
Posts: 110

Original Poster
Rep: Reputation: 15
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

Last edited by brazilian_user; 12-05-2006 at 08:07 AM.
 
Old 12-05-2006, 08:51 AM   #4
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Thumbs up

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'
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the scripts in /etc/init.d for? blackzone Linux - General 7 09-06-2006 11:10 PM
init scripts lvgandhi Debian 2 10-11-2005 02:44 AM
New init scripts? xconspirisist Fedora 9 12-09-2004 11:41 AM
Bootsplash init scripts TheRepublican Slackware 5 05-11-2004 02:13 AM
Scripts in /etc/rc.d/init.d correro Linux - General 1 03-13-2003 09:47 PM


All times are GMT -5. The time now is 07:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration