Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-30-2007, 12:58 AM   #1
Registered: Oct 2005
Location: Bangladesh
Posts: 498

Rep: Reputation: 30
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 .. ..
Old 08-30-2007, 03:19 AM   #2
Senior Member
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
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


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LSB service shutdown tate_harmann Linux - Newbie 1 08-20-2007 03:12 PM
Slack problems 1)incomplete shutdown? 2)starting a service koodoo Linux - Newbie 5 06-08-2005 11:22 AM
Terminal Executes unwanted command at openning blames Linux - General 4 12-28-2004 04:16 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
Service Shutdown and Init Setup g_goblin Solaris / OpenSolaris 1 10-29-2003 03:53 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:30 AM.

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