Hi monks,

I have two things to be done.

The above two has to be a separate script. 1. firmwareupdate.pl
my $prompt = '/\/\.\/->/'; my $con = new Net::Telnet(Timeout => 400, Prompt => $prompt); $con->open("192.168.1.1"); $con->login("admin", "password"); my $prompt = '/\/\.\/map1\/firmware\/->/'; my @lines = $con->cmd(String => "cd /map1/firmware", Prompt => $prompt +); my $load_firmware = "load -source //14.0.1.0/test.bin -oemhpfiletype c +sr"; @lines = $con->cmd(String => $load_firmware, Prompt => $prompt); print join "\n",@lines; @lines = $con->cmd(String => 'reset', Prompt => '/Map1 reset\./'); $con->close();
2.loadcert.pl
my $prompt = '/\/\.\/->/'; my $con = new Net::Telnet(Timeout => 400, Prompt => $prompt); $con->open("192.168.1.1"); $con->login("admin", "password"); my $prompt = '/\/\.\/map1\/firmware\/->/'; my @lines = $con->cmd(String => "cd /map1/firmware", Prompt => $prompt +); my $load_firmware = "load -source //14.0.1.0/cert.pem -oemhpfiletype c +sr"; @lines = $con->cmd(String => $load_firmware, Prompt => $prompt); print join "\n",@lines; @lines = $con->cmd(String => 'reset', Prompt => '/Map1 reset\./'); $con->close();
3. Mainexecution.pl
my $cmd = "perl firmwareupdate.pl" if ( system($cmd) == 0 ) { print "sucess\n"; } else { print "Failed\n"; } $cmd = "perl loadcert.pl" if ( system($cmd) == 0 ) { print "sucess\n"; } else { print "Failed\n"; }

When executing Mainexecution.pl always first called script alone is getting success. If i call loadcert.pl first its getting success, when executing next script its stopped with the error "Download Unsuccessful". What could be the issues? I checked the closing part of the first called script, its returning success i.e closing perfectly.

If any body has knowledge on this, kindly give your ideas.


In reply to Net:::Telnet - two consecutive connection by perldesire

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.