maskull has asked for the wisdom of the Perl Monks concerning the following question:
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;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Net::Telnet: remote job completion
by Eliya (Vicar) on Feb 28, 2012 at 10:37 UTC | |
by maskull (Novice) on Feb 28, 2012 at 10:55 UTC | |
by Eliya (Vicar) on Feb 28, 2012 at 14:04 UTC | |
by maskull (Novice) on Feb 29, 2012 at 13:41 UTC | |
Re: Net::Telnet: remote job completion
by wwe (Friar) on Feb 28, 2012 at 12:20 UTC | |
Re: Net::Telnet: remote job completion
by salva (Canon) on Feb 29, 2012 at 14:11 UTC | |
Re: Net::Telnet: remote job completion
by sundialsvc4 (Abbot) on Feb 28, 2012 at 20:21 UTC | |
by maskull (Novice) on Feb 29, 2012 at 13:45 UTC | |
by sundialsvc4 (Abbot) on Feb 29, 2012 at 14:17 UTC |