turn2me5 has asked for the wisdom of the Perl Monks concerning the following question:
Hi ,
I am required to execute a command from my windows machine on to a Linux machine. Currently I am using Net::Telnet package for that.
<pr>
Now that I want to check the status of that command on my Windows machine. Is there some way where in I can return a magic string to my windows machine on the basis of value of $? variable on Linux machine.
I am attaching my code here.
Prompt reply would be appreciated.. :)
Please let me know whether I can modify the same code or I need to use some totally different module than Net::Telnet..$username="imail1"; $passwd="imail1"; use Net::Telnet (); $t = new Net::Telnet (Timeout => 10); $t->open("172.16.14.74"); $t->print($username); $t->print($passwd); sleep(5); open(FHH, ">output.txt"); print FHH $t->cmd("cp opwv/config/config.db ./"); $flag=1; close(FHH); open(FH,"<output.txt"); while(<FH>) { if($_ =~ "ERROR"){ $flag = 0; } } if ($flag == 0) { print "Fail"; } else { print "Pass"; } close(FH); unlink("output.txt");
Prompt reply would be appreciated.. :)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Want to communicate status of the last command to Windows machine
by vladdrak (Monk) on Dec 19, 2006 at 07:20 UTC | |
by turn2me5 (Initiate) on Dec 19, 2006 at 07:37 UTC | |
by vladdrak (Monk) on Dec 19, 2006 at 08:59 UTC | |
by RedTussock (Acolyte) on Oct 07, 2012 at 17:20 UTC |
Back to
Seekers of Perl Wisdom