LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 11-12-2007, 06:14 AM   #1
deepugopi
LQ Newbie
 
Registered: Apr 2007
Location: India
Distribution: RHEL4,Fedora6
Posts: 28

Rep: Reputation: 15
S or K in the shutdown/reboot scripts...


We are using Cadence tools in our company.Before start using the cadence tools we have to run one script,license file, everytime when machine boots. I've placed that boot time script in /etc/init.d & placed a link in /etc/rc.d/rc5.d as S98startlic.
Now i've to place another script file, which will stop the cadence license file, in the /etc/rc.d/rc0.d & rc6.d. This new script has to run before shutting down/rebooting the machine.
What should i do in /etc/rc0.d such that the license file will be stopped automatically.Shutting down the license should be the first thing to do when some gives shutdown/reboot command
I want to stop the S98startlic by running stoplicense file script. So shud i use K01startlic or S98stoplicense.
i want to start one script (stoplic file) to stop another script(startic).Should i use "S" or "K"..

Please explain what should i do in such a scenario...
 
Old 11-12-2007, 07:15 AM   #2
WAJEDUR REHMAN
Member
 
Registered: Aug 2007
Posts: 43

Rep: Reputation: 15
Hi
You must use K cause you'r running this script when shouting down or rebooting not on startup

"S" which signifies the script should be run at startup

"K", which means the script should be run when the system is shutting down
 
Old 11-13-2007, 12:18 AM   #3
deepugopi
LQ Newbie
 
Registered: Apr 2007
Location: India
Distribution: RHEL4,Fedora6
Posts: 28

Original Poster
Rep: Reputation: 15
Hi,
Sorry please correct me if i'm wrong. What i know is that "s" indicates scripts which has to be started & "K" indicates scripts(running scripts) which has to be stopped. in /etc/rc.d/rc0.d we can see both "k" & "S" scripts.
 
Old 11-13-2007, 05:14 AM   #4
kangen
LQ Newbie
 
Registered: Oct 2007
Posts: 15

Rep: Reputation: 0
Quote:
Originally Posted by deepugopi View Post
Hi,
Sorry please correct me if i'm wrong. What i know is that "s" indicates scripts which has to be started & "K" indicates scripts(running scripts) which has to be stopped. in /etc/rc.d/rc0.d we can see both "k" & "S" scripts.
Hello, first of all its very important to notice that its large caps. All the files starting with S will be runned at server startup and in numberic order starting from 1-99.

The files starting with K will be executed at server shutdown/reboot.
 
Old 11-13-2007, 09:24 AM   #5
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
You are supposed to write single script that will handle starting and stopping (restarting, status checking, etc) the process then by linking to it with either K or S in the various run levels instructs the script what to do... I have never seen a process that used separate scripts for starting and stopping..

Writing sysVinit scripts

write sysVinit scrips
 
Old 11-13-2007, 02:43 PM   #6
scotlarsen
Member
 
Registered: Sep 2006
Posts: 35

Rep: Reputation: 15
Indeed.

# ls -lah /etc/rc*.d/*sshd
lrwxrwxrwx 1 root root 14 Nov 6 05:47 /etc/rc0.d/K25sshd -> ../init.d/sshd
lrwxrwxrwx 1 root root 14 Nov 6 05:47 /etc/rc1.d/K25sshd -> ../init.d/sshd
lrwxrwxrwx 1 root root 14 Nov 6 05:47 /etc/rc2.d/S55sshd -> ../init.d/sshd
lrwxrwxrwx 1 root root 14 Nov 6 05:47 /etc/rc3.d/S55sshd -> ../init.d/sshd
lrwxrwxrwx 1 root root 14 Nov 6 05:47 /etc/rc4.d/S55sshd -> ../init.d/sshd
lrwxrwxrwx 1 root root 14 Nov 6 05:47 /etc/rc5.d/S55sshd -> ../init.d/sshd
lrwxrwxrwx 1 root root 14 Nov 6 05:47 /etc/rc6.d/K25sshd -> ../init.d/sshd

chkconfig is a very good tool for managing the sym links in the rc dirs.
 
Old 11-14-2007, 12:35 AM   #7
deepugopi
LQ Newbie
 
Registered: Apr 2007
Location: India
Distribution: RHEL4,Fedora6
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks all of you for your valuable inputs. But still i'm bit confused. I'll better explain the scenario i'm facing right now.

Like i said earlier we are using cadence tools, like IUS. Two things about using this s/w
1. we have to run the cadence license file first (its a "rc.lic" file) before starting the cadence application => Currently this is working fine, i've made a copy of above file & places it in the /etc/init.d/ .. then made a sym link to /etc/rc.d/rc5.d with name "S98Startiuslic" (without cords surely !!!).

2. We have to shut down the license daemon,lmgrd, first before shutting down/rebooting the machine. For that we are supposed to run "lmdown"(exact path is /ius62/tools/bin/lmdown )command.Actually i've to run "lmdown -q", so that it won't prompt anything ...
=> What i've done is that i made a script called stopiuslic & placed in /etc/init.d/ & made a symlink to /etc/rc.d/rc0.d & /etc/rc.d/rc6.d with name K02stopiuslic

The stopiuslic script content is as follows..
#!/bin/sh
# Stopping Cadence License Manager during shutdown/reboot stages
/ius62/tools/bin/lmdown -q
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripts under rc0.d and rc6.d do not seem to run during shutdown.reboot oferu Linux - Newbie 4 03-26-2008 11:34 AM
KDE shutdown scripts Crobat Linux - General 8 05-23-2007 02:03 AM
shutdown scripts? mushmaster Linux - Software 5 02-15-2005 07:23 PM
Emergency Shutdown scripts? samroberts Linux - Enterprise 3 10-29-2004 05:48 AM
Where do you place shutdown scripts? zer0halo Linux - Newbie 3 08-24-2004 04:43 PM


All times are GMT -5. The time now is 04:16 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