+ -
当前位置:首页 → 问答吧 → perl telnet 模块的问题

perl telnet 模块的问题

时间:2010-12-31

来源:互联网

#!/opt/dc_perl

use Net::Telnet;

print "\nUsage: get_alarm.pl remote_host_ip port User_Name Password \n\n";

my $remote_host_ip = $ARGV[0];
my $port = $ARGV[1] ;
my $username = $ARGV[2] ;
my $password = $ARGV[3] ;
my $recv_file_name = $ARGV[4] ;

my $first_cmd ="cd /tellin/oams/oams_run/log";
my $second_cmd = "ps -ef|grep -v grep|grep tail|awk '{print $2}'|xargs kill -9";
my $third_cmd = "tail -f /tellin/oams/oams_run/log/oams_warninglog_usr.log";


print "ipremote_host_ip\n";
print "portport\n";
print "loginusername\n";
print "passwdpassword\n";

my $telnet_hd=new Net::Telnet (Timeout => 3600);
print "now telnet......\n";
#$telnet_hd->open(Host=>$remote_host_ip);
$telnet_hd->open(Host=>$remote_host_ip,Port=>$port);
print "now open ......\n";
$telnet_hd->login(login=>$username,Password=>$password);
print "now login......\n";

执行perl程序的时候提示如下,哪位帮忙看看是啥问题啊?
Usage: get_alarm.pl remote_host_ip port User_Name Password
ip:192.168.1.149
port:23
nameams
passwdams
now telnet......
now open ......

手工telnet服务器的时候
telnet 192.168.1.149
Trying 192.168.1.149...
Connected to 192,168.1.149.
Escape character is '^]'.
Welcome to SUSE Linux Enterprise Server 10 SP1 (x86_64) - Kernel 2.6.16.46-0.12-smp (2).

linux-461u login:

作者: liuxiaozhe   发布时间: 2010-12-31

你的prompt 在哪?

作者: meihuaqi   发布时间: 2010-12-31