joes77 has asked for the wisdom of the Perl Monks concerning the following question:
I'm using a sysinternal psexec utility to stop the AV client service. Here the stopsmc() function may continuously try to stop the service but does not succeed and hence the script is unable to go forward with the next machine. I would like to know whether any logic can help me - to go to the next machine if one machine get stuck for a particular time period. I was thinking something like this if stopsmc did not give a result for say 5 minutes or so go to next machine. Let me know If I did not make myself clear.foreach $machine (@old) { chomp ($machine); stopsmc(); #Function to Stop the AV client timedelay(); #Function to delay time startsmc(); #Function to Start the AV client } sub stopsmc{ my $stop='psexec' . " " . '\\\\' . $machine . " " .$smc. " " .' - +p ' . " " . "[password]". " " . "-stop"; if(system("$stop")) { print "SMC Stopped,"; } else { print "SMC Not Stopped,"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A way to break if an action is not responding and go to next?
by cdarke (Prior) on Jul 17, 2011 at 10:44 UTC | |
|
Re: A way to break if an action is not responding and go to next?
by Anonymous Monk on Jul 17, 2011 at 07:35 UTC |