Re: [Ssh-sftp-perl-users] Net::SSH::Perl is hanging
Brought to you by:
dbrobins
From: Matthew J. S. <vag...@ya...> - 2006-08-01 13:48:14
|
I had a similar problem awhile back. I ended up using pieces from the module in the main script. The client loop and the shell subs were most important. I put the end result of the script on sourceforge, if you go throught the source, you should find what you need. http://sourceforge.net/projects/scriptable-ssh Good luck --- Markus <ma...@ni...> wrote: > I try to manage VPN gateway by using SSH, which > using a readhat kernel. > During the login process is possible to run in to a > dialog which needs to be > answered. > > The dialog looks like this: > > > > WARNING: There exist other CLI sessions. > > > > Current sessions (including this session): > > Logged on From > > Wed Jul 26 11:41 192.168.1.36 > > Wed Jul 26 11:41 192.168.1.37 > > > > Kill other sessions (yes/no) [no]: > > > > It seams that the own scrip is opening a second > session from the beginning. > Also is he probably waiting for the prompt. > > How ever, on this dialogis hanging my script (line > 15: $ssh->shell();). If I > don't use the shell mode than I run in another > problem by applying a command > (ERROR: Only interactive login supported). > > > > I need to know: > > * how satisfy this dialog? > > * suppress the message > > IO::Socket::INET at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line > 295 > > IO::String at > C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110 > > > > Here the scrip output > > ################################################################## > > ... > > IO::String at > C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110 > > IO::Socket::INET at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295 > > IO::String at > C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110 > > IO::String at > C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 118 > > > > > > WARNING: There exist other CLI sessions. > > > > Current sessions (including this session): > > Logged on From > > Wed Jul 26 12:57 192.168.1.42 > > unknown unknown > > > > Kill other sessions (yes/no) [no]: IO::Socket::INET > at > C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295 > > IO::String at > C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110 > > ################################################################## > > > > > > Here the test script it self > > ################################################################## > > #!/usr/local/bin/perl > > use strict; > > use warnings; > > use Net::SSH::W32Perl; > > STDOUT->autoflush(1); > > > > my $ssh = new Net::SSH::W32Perl('192.168.1.102', > debug => 1); > > $ssh->login('admin', 'go'); > > $ssh->shell(); > > > > my ($out, $err, $exit) = $ssh->cmd('/inf'); > > print "OUTPUT: $out\n"; > > print "ERROR: $err\n"; > > print "EXIT_code: $exit\n"; > > ################################################################## > > > > thanks > > Markus > > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get > the chance to share your > opinions on IT & business topics through brief > surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |