Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Want to communicate status of the last command to Windows machine

by vladdrak (Monk)
on Dec 19, 2006 at 08:59 UTC ( [id://590625]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Want to communicate status of the last command to Windows machine
in thread Want to communicate status of the last command to Windows machine

This code works for me against a debian etch machine -- should be very similar to another flavor of Linux, though. (You also might consider the Net::SSH module..!):
#!/usr/bin/perl use strict; use warnings; use Net::Telnet; my $host = "somehost"; my $username = "test"; my $password = "password"; my $t = new Net::Telnet; $t->dump_log('trace.log'); # detailed packet trace $t->open($host) or die "could not connect to $host: $!\n"; $t->print($username); $t->waitfor('/ssword[:] $/'); $t->print($password); $t->waitfor('/\$ *$/'); $t->print("cp a b"); $t->getline(); # read prompt my $stdout = $t->getline(); print "stdout $stdout\n"; $t->print("echo \$?"); $t->getline(); # read prompt my $exitcode = $t->getline(); print "exit $exitcode\n"; exit($exitcode);
  • Comment on Re^3: Want to communicate status of the last command to Windows machine
  • Download Code

Replies are listed 'Best First'.
Re^4: Want to communicate status of the last command to Windows machine
by RedTussock (Acolyte) on Oct 07, 2012 at 17:20 UTC
    Ta Thanks ...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://590625]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-19 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found