hello monks..

I am trying to submit a job (which is embedded in a shell script) using 'qsub'. I tried running the code using various options in perl, but each time when it runs, it submits the job but exits the perl program and does not wait for the job to be finished.

I need the program to wait till the queued job is finished and then based on job output do other things later. Any help will be appreciated. I tried..
$job = "/usr/bin/qsub pbs_job.sh"; $status = system($job); #it submits the job here and #exits perl code If ($status == 0) { do something }
2. using pipes
$job = "/usr/bin/qsub pbs_job.sh"; open(my $status, "-|", $job) or die "couldn't launch qsub job: $!/$?\n"; for (<$status>) { print "$_"; } close $status;
thanks.. mjr.

In reply to submitting job to a queue by mjr1n1

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.