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

This node was taken out by the NodeReaper on Jul 18, 2011 at 13:36 UTC
  • Comment on Reaped: Re: A way to break if an action is not responding and go to next?

Replies are listed 'Best First'.
Re: Reaped: Re: A way to break if an action is not responding and go to next?
by joes77 (Novice) on Jul 19, 2011 at 02:26 UTC
    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"; }
      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); }