• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Do shell script question - timeouts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Do shell script question - timeouts


  • Subject: Do shell script question - timeouts
  • From: Alex Zavatone <email@hidden>
  • Date: Sun, 01 Apr 2012 12:34:24 -0400

Hi.  I was thinking of writing a quick automatic file sharer by detecting all the local machines on a network and setting up a share on each.

To do this, I was trying this:

set myShellString to "mdns -B _afpovertcp._tcp. local > ~/AFP.txt 2>&1"
do shell script myShellString

set myShellString to "killall mDNS"
do shell script myShellString

But the shell command mdns doesn't stop, so the execution doesn't proceed past the first shell script, so I tried this:

on main()
	try
		with timeout of 1 second
			set myShellString to "mdns -B _afpovertcp._tcp. local > ~/AFP.txt 2>&1"
			do shell script myShellString
		end timeout
	end try

	set myShellString to "killall mDNS"
	do shell script myShellString
end main


But that seems sort of lame, almost like a cop out.  Is there is a preferred method to say to the shell to run for a while, to not wait for a response, or is this the way to do it?

Thanks,
- Alex
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Do shell script question - timeouts
      • From: Doug McNutt <email@hidden>
  • Next by Date: Re: Do shell script question - timeouts
  • Next by thread: Re: Do shell script question - timeouts
  • Index(es):
    • Date
    • Thread