#Start the remote shell and get the PID of the process #Pipe the output into a file chomp($pse_id=`remsh $status[0] ps –ef | grep ‘pse’ | grep –v grep | wc –l>pse_status &`); my $not_done=1; my $error_count=0; while ($not_done==1) { my $running=`ps –ef | grep ‘$pse_id’ |grep –v grep |wv –l`; if ($running==0) { #process is still running, sleep then try again increment error counter if ($error_count>10) { ¬ify_FOT; } else { $error_count++; } sleep(5); } else { open(TEMP,”; close(TEMP); $pse=chomp($temp[0]); last; # or $not_done=0; } }