in reply to Reaped: Re: A way to break if an action is not responding and go to next?
in thread A way to break if an action is not responding and go to next?

Thanks for all your help. In fact your posts helped to go forward with the below code; system ($stop) is trying to stop the smc service and in case the remote system doesn't respond within 30 seconds the script will come out from it and system ($kill) will kill the psexec process in the remote machine and hence the pipe is ended. pskill is a similar sysinternal utility to kill a process remotely
$SIG{ALRM} = \&timed_out; eval { alarm (30); system ($stop); alarm(0); }; if ($@ =~ /GOT TIRED OF WAITING/) { my $kill='pskill' . " " . '\\\\' . $machine . " " . "psexesvc +"; system ($kill); sub timed_out { die "GOT TIRED OF WAITING"; }
  • Comment on Re: Reaped: Re: A way to break if an action is not responding and go to next?
  • Download Code

Replies are listed 'Best First'.
Re^2: Reaped: Re: A way to break if an action is not responding and go to next?
by cdarke (Prior) on Jul 19, 2011 at 10:05 UTC
    OK, but I assumed you were running on Windows, and alarm does not work on any of the Windows implementations I have seen.

    Update:BTW, you have lost a trailing '}', and your indentation is messed up. This is how I would have written the conditional:
    if ($@ =~ /GOT TIRED OF WAITING/) { my $kill='pskill' \\\\$machine psexesvc"; system ($kill); }