baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
I need an advice regarding a particular problem.
Couple of years ago i have been working on a program that starts other programs.The way that i tackled with the problem back then was , and i believe still is a bit wonky and now it bit me in the a... So what was the problem:
I have a main program that starts other programs given some other input let just treat this input as time . so on every full hour the main program will start some other program. Once the program is started the given process has to be detached from the main. The way i did this back then was :
Now the reason i did it this way was because it was necessary to kill all running programs once the main program stops running. However though this worked for a while, recently with the new Rocks OS some background processes do not end when the main program is terminated. So what i am looking for is an alternative to the above described procedure. Something stable. Perfect solution would be that i have a complete control over my background processes in a way that once i detached the process, i can get its pid. With this information i could manually check if a specific process is still running or not and if it is, then kill it.##main.pl my $x = 0; while(1){ sleep 3600; $x++; # fork the process exec("./program$x &"); }
Any ideas ??
Cheers,
Baxy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Detachment problm
by Corion (Patriarch) on May 27, 2012 at 09:11 UTC | |
|
Re: Detachment problm
by Marshall (Canon) on May 27, 2012 at 10:42 UTC | |
by baxy77bax (Deacon) on May 27, 2012 at 21:08 UTC | |
|
Re: Detachment problm
by Anonymous Monk on May 27, 2012 at 08:32 UTC |