Catching Kill Processby Jabox (Sexton)
|on Jun 24, 2014 at 16:06 UTC||Need Help??|
Jabox has asked for the
wisdom of the Perl Monks concerning the following question:
I need assistance with a program to catch a kill process, finish the command, and then end script without just getting cut off halfway and not finish. I will try my best to explain
Files : Perl Program, Custom Module.
Perl Program - Asks for "command, Interval, Location"
What I wanted it to do:
Perl Program calls Functions in Custom Module. Module runs "mpstat 5 ." forever.
When using Kill command "Control+C", mpstat will stop, continue to the rest of the code in the module which Creates .html and .png graph files with what ever result mpstat has made.
What it does :
Closes while mpstat is still running, doesn't create files or graphs.
Some code examples:
IN PERL PROGRAM
So I want the program to just get the information, calls function in module where command is ran until process is killed, then moves the files to designated location
I want to make it where it kills only the 'mpstat' commands if I use the "control+c", the code still continues and does the part where the output information are assigned to arrays and made into html and png files
What I've tried:
I gave it a guess to see if it works since I don't understand it and it doesn't work...
Anyone know how to do this or know where I can read up on it? I've been searching around the web and some pages just prints "caught signal" but doesn't really tell me how to make it do what I wanted it to do
Thank you in advance and if it doesn't make sense or need more information let me know please!