running a command in remote machine by using perl
Posted
by Bharath Kumar
on Stack Overflow
See other posts from Stack Overflow
or by Bharath Kumar
Published on 2010-04-28T05:58:32Z
Indexed on
2010/04/28
6:03 UTC
Read the original article
Hit count: 549
perl
|perl-module
Hi All,
I'm using following code to connect to a remote machine and try to execute one simple command on remote machine.
cat tt.pl
!/usr/bin/perl
use strict;
use warnings;
use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>2, Errmode=>'die');
$telnet->open('172.168.12.58');
$telnet->waitfor('/login:\s*/');
$telnet->print('admin');
$telnet->waitfor('/password:\s*/');
$telnet->print('Blue');
$telnet->cmd('ver > C:\log.txt');
$telnet->cmd('mkdir gy');
You have new mail in /var/spool/mail/root
[root@localhost]#
But when i'm executing this script it is throwing error messages
[root@localhost]# perl tt.pl
command timed-out at tt.pl line 12
[root@localhost]#
Please help me in this
© Stack Overflow or respective owner