Hello all,

I'm using my Perl script to Net::Telnet to an AIX box and execute several consecutive scripts. Each one has to wait for the predecessor to finish before it can start.

Before Perl, I would log in using telnet, fire up the first script and then do "tail -f" on the job's log as each one writes to a separate one. When the job completed I'd get the last line saying "FINISHED". Then I'd know I can get on with the next one.

So how do I emulate that "tail -f" with Perl? Or do I take another approach to check whether the job has finished, e.g. grab the job's PID and periodically check if it's still there?

I'm afraid my code isn't really useful at this point. It is only the beginning. I'd appreciate any input. Thank you!

use Net::Telnet; my $telnet = new Net::Telnet(Timeout => 35,Errmode => 'die'); $telnet->open("10.10.10.11") or die "Connection failed $telnet->errmsg + "; $telnet->waitfor('/login: $/i'); $telnet->print("user") or die $telnet->errmsg; $telnet->waitfor('/password: $/i'); $telnet->print("pass") or die $telnet->errmsg; $telnet->waitfor('/prompt> $/i'); @lines = $telnet->cmd("script_01") or die $telnet->errmsg;

In reply to Net::Telnet: remote job completion by maskull

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.