LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   script/service/command executes during shutdown (http://www.linuxquestions.org/questions/linux-newbie-8/script-service-command-executes-during-shutdown-580862/)

shipon_97 08-30-2007 01:58 AM

script/service/command executes during shutdown
 
Friends ,

I want to shutdown a Linux service (Like tuxedo service) During shutdown command , i.e., When I have to poweroff my Liux (RHEL 4) server, then some third party installed service will be automatically shutdown before poweroff the server .


I have another question ,

During startup if I want to give some command/scripts (scripts which contains 1 or 2 lines) in "/etc/rc.local" then it will be automaticaly executed during startup the server .

Just Like this , is there any file Like "rc.local" which is executed only during shutdown the server .
Becaue I need to shutdown some third party service(Like tuxedo,cobol) first during shutting down the server .

If any .. plz informed .. ..

zhjim 08-30-2007 04:19 AM

Coming from slackware i just edited the files /etc/rc.d/{rc.6,rc.0} (one is a symlink) to call a script.

When I recall right in Debian you got "/etc/rc6.d". just create a file like "K50thirdparty". Within you can call scripts or whatever you like.
(The rule on the number of K is the number of the script with the same name and an S in front subtracted by 100. S40thirdparty = K60thirdparty)

But I think the appropiate way to do it is to have the thirdparty script in your default runlevels rc directory. Mostly rc3.d. Just put a K file in there and you should be set. (type runlevel on cmd to see the actual runlevel. vi /etc/inittab can tell you which is your default runlevel.)

For clearence:
All file in the rc*.d directory with a S in front get executed when entering the runlevel. And all the files with a K in front get executed when leaving the runlevel.

Greetz Zhjim


All times are GMT -5. The time now is 01:51 PM.