Re: Ignoring responses from "do shell script"
Re: Ignoring responses from "do shell script"
- Subject: Re: Ignoring responses from "do shell script"
- From: Graff <email@hidden>
- Date: Tue, 09 Mar 2004 19:15:09 -0500
Hmm it worked fine here. There is a built-in delay of 15 seconds that
I placed in the script so that every ping has a chance to return but
beyond that the script should take almost no time to run. I tried a
list of about 20 good and bad addresses and still ended up with the
script taking only about 15 seconds to run.
The block that you quoted essentially does open up a bunch of shell
sessions and has them all write to a common file. It then waits 15
seconds after the last ping is done and then combs through the file for
all of the results.
I just tested it on 50 addresses and it still took about 15 seconds
total. One problem I noticed though was that when I tried about 100
random addresses the script bombed out because apparently I had forked
off too many processes. To prevent this I would do this script in 50
address bunches, waiting 15 seconds between each bunch. This can
easily be done with two loops in this manner (replacing the part that
you quoted below):
------------
repeat with i from 0 to ((count of pingList) / 50)
set start to i * 50 + 1
repeat with j from start to (start + 49)
set theIP to item j of pingList
do shell script "ping -c 1 " & theIP & " >> " & pingPosix & "
2>&1 &"
end repeat
delay 15
end repeat
------------
So for every group of 50 addresses it will take approximately an
additional 15 seconds to execute.
-Ken
On Mar 9, 2004, at 6:15 PM, Martin Orpen wrote:
on 9/3/04 8:40 pm, Graff at email@hidden wrote:
repeat with theIP in pingList
do shell script "ping -c 1 " & theIP & " >> " & pingPosix & " 2>&1 &"
end repeat
Unfortunately, this doesn't work as the delays are still there. For
every
failed ping there is a 10 second delay.
Perhaps the only way to go *parallel* is to launch *n* Terminal
windows with
separate ping commands and then collecting the results after 10-15
seconds?
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.