Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I apoligize in advance, but company restrictions forbid me from posting any code. Even though I had to teach myself perl, I will try to make my request for wisdom as clear as possible.

I'm trying to write a script that calls 2 other perl scripts, then a MATLAB script followed by a 3rd perl script. I have no problem getting any of the programs to start and run correctly, but I can't seem to figure out how to make the last perl script wait until the MATLAB script is finished before it is called.

For error checking I decided to call MATLAB using system(), because I thought perl waits until the program is finished and assigns a value of 0 upon a succesful exit. What system seems to actually do is return 0 once MATLAB starts.

The goal is to automate these 4 tasks to run every night after my co-workers and I leave for the day. The MATLAB program and last perl script are very resource-intensive processes that take at least 4 hours each to complete. Because the present version of my script calls the last script before MATLAB is finished, both programs run at the same time and crash the system.

My question is, how can I force perl to wait until MATLAB is finished before calling the last program? I currently call MATLAB in background mode (the program does not load as a GUI like normal, and returns all results in a log file upon exit).

In reply to Calling External Program by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-20 12:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found