• 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
Re: running shell in background....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: running shell in background....


  • Subject: Re: running shell in background....
  • From: Harald Schneider <email@hidden>
  • Date: Mon, 03 Sep 2007 18:41:06 +0200

Can you pls post the link to the complete FAQ?


Thank you very much, Harald



Luther Fuller wrote:
On Sep 2, 2007, at 5:18 AM, Harald Schneider wrote:
Is there a way to start a shell script as a background process ?

Using info from the "do shell script" FAQ, I've been doing something like this in a number of my AppleScripts ...


    -- start primary process ---------------------
    do shell script primaryCommand & " &> /dev/null & echo $!"
    set primaryPID to the result

    -- start secondary process -------------------
    do shell script secondaryCommand & " &> /dev/null & echo $!"
    set secondaryPID to the result

repeat -- wait for primary process to complete ----------
do shell script "ps -p " & primaryPID
if not (the result contains primaryPID) then exit repeat
delay 1
end repeat
-- stop secondary process -----------------------
if secondaryPID > 0 then do shell script "kill " & secondaryPID



The secondary process gives me an audible/visual indication that the primary process is still running. However, the primary process does return progress info, I just can't find any way to read this into my script in a repeat loop.


What I really need is a good book that explains what " &> /dev/null & echo $!" and its variants really mean in careful detail. The only book I have is too brief to explain this. Any suggestions?

(On the other hand, I really like listening to music while burning a DVD, and may not want to change a good thing.)

_______________________________________________
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


--


_______________________________________________________________________________

Harald Schneider
Softwareentwicklung + Mediadesign
Kreuzweg 17 - 66663 Merzig - Germany
USt-Ident DE163098498

Tel: 49 6861 792145  Fax: 49 6861 792146
Skype: hschneider66 ( skype:hschneider66?add )
_______________________________________________
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: running shell in background....
      • From: Luther Fuller <email@hidden>
References: 
 >Non blocking "do shell script" ? (From: Harald Schneider <email@hidden>)
 >Re: running shell in background.... (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: frontmost doesn't work???
  • Next by Date: Re: frontmost doesn't work???
  • Previous by thread: Re: running shell in background....
  • Next by thread: Re: running shell in background....
  • Index(es):
    • Date
    • Thread