LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 05-23-2013, 08:35 AM   #1
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 228

Rep: Reputation: 9
rc Kill and Startup scripts confusion


Hello All,

First of all, i was not sure where exactly to put this question because this is definatly not a newbie question . I was having a general discussion related to staring and stopping of services when a system is starting and going down.

I know that there are scripts in /etc/rc.n(0-6) which have scripts named as K(for kill) and S(for start) which are executed during the startup and shutdown which actually casued the service to start or stop.

Now what i don't know and able to understand is that both these scripts (K and S) and symlinked to /etc/init.d service script which ultimately acts accrodingly.

Quote:
# ll /etc/rc1.d/|grep -i crond
lrwxrwxrwx 1 root root 15 Mar 30 2009 K60crond -> ../init.d/crond
root@mgtl0010:/etc
# ll /etc/rc3.d/|grep -i crond
lrwxrwxrwx 1 root root 15 Mar 30 2009 S90crond -> ../init.d/crond
root@mgtl0010:/etc
Looking at some init.d scripts i found that their action depends on the 1st positional parameter; which WE provide and could be one of the four(Start|Stop|Restart|Status) or more depending on the service.

However when a Kill script is executed(which again refers to /etc/init.d/service) during init6 or init0 there is no Positional parameter passed and same case happens when Start script is run during system startup.

So how does the /etc/init.d/service script finds the necessary Positinal Param which which causes service to stop when it is referred via Kscript and Service Startup when it is referred via Sscript.

I have tried my best to explain the question, if at all you are unable to understand my question please do tell me and i will try to furtehr explain.

Last edited by Rohit_4739; 05-23-2013 at 08:37 AM.
 
Old 05-23-2013, 09:15 AM   #2
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 228

Original Poster
Rep: Reputation: 9
Quote:
Originally Posted by Rohit_4739 View Post
Hello All,

First of all, i was not sure where exactly to put this question because this is definatly not a newbie question . I was having a general discussion related to staring and stopping of services when a system is starting and going down.

I know that there are scripts in /etc/rc.n(0-6) which have scripts named as K(for kill) and S(for start) which are executed during the startup and shutdown which actually casued the service to start or stop.

Now what i don't know and able to understand is that both these scripts (K and S) and symlinked to /etc/init.d service script which ultimately acts accrodingly.



Looking at some init.d scripts i found that their action depends on the 1st positional parameter; which WE provide and could be one of the four(Start|Stop|Restart|Status) or more depending on the service.

However when a Kill script is executed(which again refers to /etc/init.d/service) during init6 or init0 there is no Positional parameter passed and same case happens when Start script is run during system startup.

So how does the /etc/init.d/service script finds the necessary Positinal Param which which causes service to stop when it is referred via Kscript and Service Startup when it is referred via Sscript.

I have tried my best to explain the question, if at all you are unable to understand my question please do tell me and i will try to furtehr explain.


Finally i got my answer myself it is defined in /etc/rc.d/rc script.
 
  


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
Kill scripts not being executed upon reboot druidmatrix Red Hat 9 02-17-2009 09:03 PM
Mandriva startup scripts (need to add something to startup before X starts) thunderweasel Mandriva 3 01-01-2006 01:55 AM
Linux HA and writing scripts to kill process sceadu Programming 0 07-28-2005 04:27 AM
shaping scripts - htb.init ... confusion ? :( mikero Linux - Networking 0 02-17-2004 06:05 AM
X Startup Scripts JHuizingh Linux - General 1 09-18-2001 02:02 PM


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

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration