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.
# ll /etc/rc1.d/|grep -i crond
lrwxrwxrwx 1 root root 15 Mar 30 2009 K60crond -> ../init.d/crond
# ll /etc/rc3.d/|grep -i crond
lrwxrwxrwx 1 root root 15 Mar 30 2009 S90crond -> ../init.d/crond
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.