• 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: perl script running...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: perl script running...


  • Subject: Re: perl script running...
  • From: Dave Lyons <email@hidden>
  • Date: Thu, 6 Oct 2005 16:36:14 -0700

On Oct 6, 2005, at 2:19 PM, Martha I Espinosa wrote:
I'm stuck on a piece of code that uses grep to see if a perl script is running...

do shell script "open -a /Applications/Utilities/Terminal.app /path to perl script

...repeat...set status to do shell script "ps -x | grep perl"...

What I want to achive is: check to see if perl script is running and if it is then keep waiting until it is done... If it's done running then I want to quit terminal and continue with my applescript...

Is it a requirement that the Perl script run in a Terminal window?

If you can run the script directly, then your AppleScript will automatically wait until the script is complete. I tested this as follows:

-- Script Editor
do shell script "/tmp/test.pl"

-- contents of /tmp/test.pl (which has its "x" bit set):
#!/usr/bin/perl
print "hello\n";
system("sleep 10");
print "goodbye\n";


If you really have to use "ps | grep", then you need to guard against the possibility that various other "perl" processes are running, other than the one you are interested in. For that matter, there could be a TextEdit document open with "perl" in its pathname, and your test could be fooled. -- So try "ps -xww | grep '/path/to/perl/ script'.


If the perl script is under your control, other options include having the perl script signal its completion by creating a file at a pre-arranged location.

Cheers,

--Dave

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >perl script running... (From: Martha I Espinosa <email@hidden>)

  • Prev by Date: Fwd: perl script running...
  • Next by Date: Re: Maill.app puzzle
  • Previous by thread: perl script running...
  • Next by thread: Re: perl script running...
  • Index(es):
    • Date
    • Thread