in reply to Killing Processes Code Review
I did not understand what you are trying to do exactly.
Are you trying to kill the process if it's been running for more than 1 hour ? or you are killing the process if it doesn't match a given date/time you saved in a local file?
Does your code actually do the job? The process killing part might kill 1 process only ... is that what you really want? Here's your code which might be matched 1 time only
if ($counter == scalar(@rundates)) { print "$procids[$procloop] is outside expected time range. +\n" ; my $cmd = "ssh $nodenum kill -9 $procids[$procloop]"; #print is to see if anything is killed, and make sure comm +and syntax is correct print "$cmd\n"; system ($cmd); }
And you can avoid some of your problems like # if the 'ps' output changes order, than may cancel the wrong process by not running separate ssh commands , but using 1 command and parse the output yourself.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Killing Processes Code Review
by Anonymous Monk on Sep 13, 2010 at 15:42 UTC |