1838621 Members
2214 Online
110128 Solutions
New Discussion

rc script kill_proc.

 
Carlos_172
Frequent Advisor

rc script kill_proc.

Hi Gurus.

When "kill_proc ()" part of rc script is used?

Thanks a lot.
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: rc script kill_proc.

Shalom,

Its used to shut down the processes/daemons created by the start section of the script.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Carlos_172
Frequent Advisor

Re: rc script kill_proc.

Isn´t it done by stop section?
Ninad_1
Honored Contributor

Re: rc script kill_proc.

Carlos,

Basically you have a single script to start and stop a particular process/application when you want to start/stop that process as part of system startup/shutdown. The scripts are kept in the /sbin/rcx.d where x is the run level.
In the script wou have a start section and a stop section - The parameter start or stop is passed to this script depending on whether you are starting up or shutting down - by the rc script. and depending on this parameter the corresponding section/function is executed.

Hope this clarifies,
Ninad
Carlos_172
Frequent Advisor

Re: rc script kill_proc.

Ok. I understand start and stop paramenters. I just don´t understand when kill_proc is used ...

Thanks a lot.
Senthil Kumar .A_1
Honored Contributor

Re: rc script kill_proc.

Hi Carlos,

You are right, in way that it is done in the stop section. If you had noticed in pre 11.00 versions there weren't any functions defined in the rc scripts. Now its become more modularized by using "functions". If i wouldn't have functions I had be clustering all the last activies in the stop section, namely kill the procs and cleaning up files etc. By modularizing, I can write a function namely "kill_procs" and "clean_files" etc,etc and that way I can summon the funtion whenever i require. There by it even gives a flexibility of repeating the sequence of commands using one liners if I were to embed a conditional statement in "stop" section, instead of repeating all the lines again and again.


Regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Senthil Kumar .A_1
Honored Contributor

Re: rc script kill_proc.

one more thing to add,

stop, start are sections to be executed in "case" statement.

whereas kill_proc is just a function. something like aliasing a set of statements in shell script. It does not have any baring to summun the rc script itself, may you are confused with the fact that ,when will i do the following...

/sbin/init.d/cron kill_proc

actually the only parameter that can be validly passed are..

stop,start,stop_mesg and start_mesg

regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Carlos_172
Frequent Advisor

Re: rc script kill_proc.

ok. Then, If I don´t call this function anywhere in stop and start section, it would be mandatory, isn´t it?