ssh-sftp-perl-users Mailing List for Net::SSH and Net::SFTP - Perl modules (Page 8)
Brought to you by:
dbrobins
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(4) |
Feb
(15) |
Mar
(13) |
Apr
(8) |
May
(5) |
Jun
(21) |
Jul
(4) |
Aug
(9) |
Sep
(11) |
Oct
(14) |
Nov
(15) |
Dec
(24) |
2005 |
Jan
(10) |
Feb
(20) |
Mar
(16) |
Apr
(10) |
May
(12) |
Jun
(16) |
Jul
(18) |
Aug
(21) |
Sep
(11) |
Oct
(19) |
Nov
(16) |
Dec
(9) |
2006 |
Jan
(17) |
Feb
(32) |
Mar
(60) |
Apr
(21) |
May
(24) |
Jun
(1) |
Jul
(6) |
Aug
(18) |
Sep
(4) |
Oct
(9) |
Nov
(31) |
Dec
(10) |
2007 |
Jan
(8) |
Feb
(11) |
Mar
(3) |
Apr
(7) |
May
(4) |
Jun
(6) |
Jul
(7) |
Aug
(3) |
Sep
(2) |
Oct
(5) |
Nov
(5) |
Dec
(5) |
2008 |
Jan
(12) |
Feb
(5) |
Mar
(7) |
Apr
(4) |
May
(37) |
Jun
(9) |
Jul
(24) |
Aug
(5) |
Sep
(2) |
Oct
(7) |
Nov
(6) |
Dec
(7) |
2009 |
Jan
(18) |
Feb
(9) |
Mar
(14) |
Apr
(14) |
May
(1) |
Jun
(14) |
Jul
(4) |
Aug
(6) |
Sep
(4) |
Oct
(12) |
Nov
(4) |
Dec
|
2010 |
Jan
|
Feb
(3) |
Mar
|
Apr
(1) |
May
(4) |
Jun
|
Jul
(6) |
Aug
(6) |
Sep
|
Oct
(7) |
Nov
(2) |
Dec
(5) |
2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
(8) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
|
Oct
(4) |
Nov
(9) |
Dec
(7) |
2012 |
Jan
(1) |
Feb
(19) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
(5) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
|
Nov
(6) |
Dec
|
2014 |
Jan
(7) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Christian K. <chr...@ci...> - 2009-04-01 23:18:07
|
Ah, I figured it out myself! use Net::SSH::Perl; sub ssh_init($$$$) { my ($username, $ip, $port, $password) = @_; my $ssh = Net::SSH::Perl->new($ip, ( protocol => '2,1', port => $port, debug => 1, interactive => 0, )); if(not defined $ssh) { print STDERR 'Creating SSH object failed'; return undef; } $ssh->login($username, $password); return $ssh; } close STDIN; my $sshHandle = ssh_init('testuser', '127.0.0.1', '22', 'password'); my ($stdout, $stderr, $exit) = $sshHandle->cmd('ls /'); print $stdout; dies with Bad File Descriptor, but if you comment out the close STDIN; line, it works fine. On Wed, 1 Apr 2009 04:25:58 pm Christian King wrote: > Hi, > > Whenever Net::SSH::Perl tries to connect to a server, it gets this error: > Could not dupe: Bad file descriptor I've tried this with a number of > servers, and have the same issue every time a successful connection is > made. > > This is a fresh install (with perl -MCPAN -e 'install Net::SSH::Perl') on > Kubuntu 8.10 > > Anyone have any ideas? Am I missing some library? > > Debug output showing the error: > devbox: Reading configuration data /home/kingc/.ssh/config > devbox: Reading configuration data /etc/ssh_config > devbox: Connecting to 127.0.0.1, port 22. > devbox: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 > Debian-3ubuntu1 > devbox: Net::SSH::Perl Version 1.34, protocol version 2.0. > .evbox: No compat match: OpenSSH_5.1p1 Debian-3ubuntu1 > devbox: Connection established. > devbox: Sent key-exchange init (KEXINIT), wait response. > devbox: Algorithms, c->s: 3des-cbc hmac-sha1 none > devbox: Algorithms, s->c: 3des-cbc hmac-sha1 none > devbox: Entering Diffie-Hellman Group 1 key exchange. > devbox: Sent DH public key, waiting for reply. > devbox: Received host key, type 'ssh-dss'. > devbox: Host '127.0.0.1' is known and matches the host key. > devbox: Computing shared secret key. > devbox: Verifying server signature. > devbox: Waiting for NEWKEYS message. > devbox: Send NEWKEYS. > devbox: Enabling encryption/MAC/compression. > devbox: Sending request for user-authentication service. > devbox: Service accepted: ssh-userauth. > devbox: Trying empty user-authentication request. > devbox: Authentication methods that can continue: publickey,password. > devbox: Next method to try is publickey. > devbox: Next method to try is password. > devbox: Trying password authentication. > devbox: Login completed, opening dummy shell channel. > devbox: channel 0: new [client-session] > devbox: Requesting channel_open for channel 0. > devbox: channel 0: open confirm rwindow 0 rmax 32768 > devbox: Got channel open confirmation, requesting shell. > devbox: Requesting service shell on channel 0. > Could not dupe: Bad file descriptor -- Christian King CITEC Security Operations |
From: Christian K. <chr...@ci...> - 2009-04-01 06:56:15
|
Hi, Whenever Net::SSH::Perl tries to connect to a server, it gets this error: Could not dupe: Bad file descriptor I've tried this with a number of servers, and have the same issue every time a successful connection is made. This is a fresh install (with perl -MCPAN -e 'install Net::SSH::Perl') on Kubuntu 8.10 Anyone have any ideas? Am I missing some library? Debug output showing the error: devbox: Reading configuration data /home/kingc/.ssh/config devbox: Reading configuration data /etc/ssh_config devbox: Connecting to 127.0.0.1, port 22. devbox: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-3ubuntu1 devbox: Net::SSH::Perl Version 1.34, protocol version 2.0. .evbox: No compat match: OpenSSH_5.1p1 Debian-3ubuntu1 devbox: Connection established. devbox: Sent key-exchange init (KEXINIT), wait response. devbox: Algorithms, c->s: 3des-cbc hmac-sha1 none devbox: Algorithms, s->c: 3des-cbc hmac-sha1 none devbox: Entering Diffie-Hellman Group 1 key exchange. devbox: Sent DH public key, waiting for reply. devbox: Received host key, type 'ssh-dss'. devbox: Host '127.0.0.1' is known and matches the host key. devbox: Computing shared secret key. devbox: Verifying server signature. devbox: Waiting for NEWKEYS message. devbox: Send NEWKEYS. devbox: Enabling encryption/MAC/compression. devbox: Sending request for user-authentication service. devbox: Service accepted: ssh-userauth. devbox: Trying empty user-authentication request. devbox: Authentication methods that can continue: publickey,password. devbox: Next method to try is publickey. devbox: Next method to try is password. devbox: Trying password authentication. devbox: Login completed, opening dummy shell channel. devbox: channel 0: new [client-session] devbox: Requesting channel_open for channel 0. devbox: channel 0: open confirm rwindow 0 rmax 32768 devbox: Got channel open confirmation, requesting shell. devbox: Requesting service shell on channel 0. Could not dupe: Bad file descriptor -- Christian King CITEC Security Operations |
From: Nigel R. <ni...@sy...> - 2009-03-18 19:54:43
|
I didn't get an answer on this so I'm reposting with a little more detail. In the system logfile I was getting a "no more sessions" error. My understanding is that under protocol 2, all commands are sent on the same session. I know it's using protocol 2 because that's the only one specified when opening a connection. Any suggestions would be appreciated. ---------------------------- Original Message ---------------------------- Subject: [Ssh-sftp-perl-users] Channel open failure: 10: reason 1: open failed From: "Nigel Reed" <ni...@sy...> Date: Mon, March 9, 2009 2:45 pm To: ssh...@li... -------------------------------------------------------------------------- Can someone explain why I am getting the following error message? Channel open failure: 10: reason 1: open failed Basically, I'm opening a connection successfully to a server, then I'm feeding commands, it handles the first 9 without a problem and then chokes. Any suggestions appreciated. Regards Nigel -- Nigel Reed Candidate for Lieutenant Governor of Marketing 2009-2010 President & CEO Sysadmin, Inc 972 673 4199 http://www.sysadmininc.com Toastmasters District 50 Vista Division Governor 2008-2009 Awareness, Attitude and Action bring Achievement! ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users -- Nigel Reed Candidate for Lieutenant Governor of Marketing 2009-2010 President & CEO Sysadmin, Inc 972 673 4199 http://www.sysadmininc.com Toastmasters District 50 Vista Division Governor 2008-2009 Awareness, Attitude and Action bring Achievement! |
From: Perl P. <per...@gm...> - 2009-03-18 16:59:34
|
Hi All, I have written a code which sends a mail using Mail::Sender utility. When I ran this code at 2 differenct machine (Linux, Solaris), observed the peculier issue. At Linux this code works fine, and sends the mail. At solaris this is not sending the mail, but no warnings & errors. I used the specific path where the Mail::Sender utility is install. Your help will be greatly appreciated. #!/usr/bin/perl #!/apps/perl/5.8.3/bin/perl use Mail::Sender; $sender = new Mail::Sender { from => 'ma...@se...', }; $sender->Open({to => 'ma...@se...', cc => 'mu...@se...', subject => 'A machine.'}); $sender->SendLineEnc("I'm sorry, but due to a big load of work, I'll come at 10pm at best."); $sender->SendLineEnc("\nMujju"); $sender->Close; -- -- Regards, Mujju |
From: Howard, C. <Ho...@pr...> - 2009-03-17 15:13:05
|
It's probably a good idea to start with some small CGI script examples to see how they work. Google "perl CGI" and you will find some. You will need an httpd server that you can practice with. -----Original Message----- From: Perl Perl [mailto:per...@gm...] Sent: Tuesday, March 17, 2009 8:45 AM To: ssh...@li... Subject: [Ssh-sftp-perl-users] Perl Login Script using CGI module Hi All, I am trying to create the CGI login script which has to take parameters like username and password ( username : ip address, password: *****). And displays the page. Here I have to use CGI module with textfield. To be honest I have not tried much on this, but simply I have embedded a snippet of code from CGI module link as below. #!/usr/local/bin/perl -w use CGI ':standard'; $query = new CGI; print textfield(-name=>'field_name', -value=>'starting value', -size=>50, -maxlength=>80); print password_field(-name=>'secret', -value=>'starting value', -size=>50, -maxlength=>80); It will be great if someone help to write the script. -- Regards, Mujju |
From: Perl P. <per...@gm...> - 2009-03-17 14:45:48
|
Hi All, I am trying to create the CGI login script which has to take parameters like username and password ( username : ip address, password: *****). And displays the page. Here I have to use CGI module with textfield. To be honest I have not tried much on this, but simply I have embedded a snippet of code from CGI module link as below. #!/usr/local/bin/perl -w use CGI ':standard'; $query = new CGI; print textfield(-name=>'field_name', -value=>'starting value', -size=>50, -maxlength=>80); print password_field(-name=>'secret', -value=>'starting value', -size=>50, -maxlength=>80); It will be great if someone help to write the script. -- Regards, Mujju |
From: Howard, C. <Ho...@pr...> - 2009-03-12 20:05:40
|
Solution! I found a google hit about not having the GMP library properly installed, causing SFTP to go into a much slower mode. I had to track down a permissions problem in my perl install directory tree, but eventually I found it. Now the negotiations are going much faster, more like what I see with the sftp commandline tool. Maybe even faster than that. Chris Howard -----Original Message----- From: Howard, Chris Sent: Thursday, March 12, 2009 11:11 AM To: Howard, Chris; 'ssh...@li...' Subject: RE: sftp to a Microsoft server regularly hangs I've done a little more research on this but still could use help. The remote server is an F-Secure 3.2.0 and I've seen some google hits about it being in some ways incompatible with OpenSSH keys. But otherwise I haven't found any particular indictment of the F-Secure server with perl SSH or SFTP. When I use my command line SFTP took it works fine. When I try my perl SFTP script it rarely gets through and when it does it takes a very long time in negotiation. Chris -----Original Message----- From: Howard, Chris Sent: Wednesday, March 11, 2009 10:46 AM To: ssh...@li... Subject: sftp to a Microsoft server regularly hangs I'm trying to use perl sftp to connect with a remote site and upload/download some files. The remote server says it is SSH Windows NT Server using protocol version 2.0. If I do this in the middle of the night, presumably things are quieter, it usually goes through without a problem. If I run my script during the day it gets through a few steps (I have debugging turned on) but eventually just seems to peter out during the negotiations, frequently while doing something about "NEWKEYS". Is there anything I can do on my end to make the protocol negotiation and all of this stuff go more quickly? in the hopes of getting the connection established and my traffic completed in a reliable fashion. Chris Howard |
From: Howard, C. <Ho...@pr...> - 2009-03-12 17:11:27
|
I've done a little more research on this but still could use help. The remote server is an F-Secure 3.2.0 and I've seen some google hits about it being in some ways incompatible with OpenSSH keys. But otherwise I haven't found any particular indictment of the F-Secure server with perl SSH or SFTP. When I use my command line SFTP took it works fine. When I try my perl SFTP script it rarely gets through and when it does it takes a very long time in negotiation. Chris -----Original Message----- From: Howard, Chris Sent: Wednesday, March 11, 2009 10:46 AM To: ssh...@li... Subject: sftp to a Microsoft server regularly hangs I'm trying to use perl sftp to connect with a remote site and upload/download some files. The remote server says it is SSH Windows NT Server using protocol version 2.0. If I do this in the middle of the night, presumably things are quieter, it usually goes through without a problem. If I run my script during the day it gets through a few steps (I have debugging turned on) but eventually just seems to peter out during the negotiations, frequently while doing something about "NEWKEYS". Is there anything I can do on my end to make the protocol negotiation and all of this stuff go more quickly? in the hopes of getting the connection established and my traffic completed in a reliable fashion. Chris Howard |
From: Thomas L. <ki1...@ya...> - 2009-03-12 10:53:04
|
Hi' These are installed in their latest versions already and those are not the problem. The code can run fine, when running in the foreground, but just as soon as input and output streams are redirected to /dev/null, then processor usage starts to blow up. On the other hand, if the code is just backgrounded without redirecting input and output streams to /dev/null, then the process received a STOP signal via a TTIN signal. shortly after start. Doing some searching indicates to me, that what I am missing is the "-n" option to ssh, but so far I have not been able to tell, how to get the "-n" option into Net::SSH::Perl. Clues anyone. Best regards. Thomas. --- Den tirs 3/3/09 skrev Nigel Reed <ni...@sy...>: Fra: Nigel Reed <ni...@sy...> Emne: Re: [Ssh-sftp-perl-users] Weird processor usage, when redirecing IO to /dev/null Til: ki1...@ya... Cc: ssh...@li... Dato: tirsdag 3. marts 2009 16.57 I had a similar issue. Doing a search, there was another module that should be installed to speed things up. It was either Math::BigInt and/or Math::BigInt::GMP Try installing those and see if it makes a difference Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på LCD TV! Se her http://dk.yahoo.com/r/pat/lcd |
From: Howard, C. <Ho...@pr...> - 2009-03-11 16:58:20
|
I'm trying to use perl sftp to connect with a remote site and upload/download some files. The remote server says it is SSH Windows NT Server using protocol version 2.0. If I do this in the middle of the night, presumably things are quieter, it usually goes through without a problem. If I run my script during the day it gets through a few steps (I have debugging turned on) but eventually just seems to peter out during the negotiations, frequently while doing something about "NEWKEYS". Is there anything I can do on my end to make the protocol negotiation and all of this stuff go more quickly? in the hopes of getting the connection established and my traffic completed in a reliable fashion. Chris Howard |
From: Perl P. <per...@gm...> - 2009-03-11 16:21:46
|
Hi All, I have coded few scripts as mentioned below. My aim is to call the files and function without using a extra file ( call.pl as mentioned below) and with the single click. I have two files, file1.pl & file2.pl In above files, I will call the common subroutine ( say code_send() ) which is located in fun.pl . Now my task is to execute the above scripts in one click. So I thougt to create a file by name *call.pl* here in this file I will add two system calls as below. system("perl file1.pl"); system("perl file2.pl"); I hope there is a better way to do this. If it is then please help me. Regards, Mujju |
From: Ken B. <ken...@co...> - 2009-03-11 01:03:59
|
You do know that you can read both dates into a gmtime structure and do everything in there. -----Original Message----- From: Nigel Reed [mailto:ni...@sy...] Sent: Tuesday, February 24, 2009 13:49 To: Perl Perl Cc: ssh...@li... Subject: Re: [Ssh-sftp-perl-users] Comparing two dates (day) & Months Three suggestions. 1) Use the Date::Calc module 2) Post to a list for general PERL questions, not one for Net::SSH::Perl 3) Pick up a copy of Perl Programming Oh, here's a free one, Dec is the 12th month. %mon2num = qw( Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6 Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec 12 ); $monthtext="Feb"; $monthnum = $mon2num{"$monthtext"}; Perl Perl wrote: >> >> Dear All, >> >> I have to compare two dates. And populate the result based on >> that. >> First date I have received from previous script, which in this form >> 5-Feb-09. >> And I have to compare this date with current date, locatime() . With the >> localtime() I will get the current Day (24),Month (2) & year (2009 ) >> >> I will split the old date as below and get the result as below. >> >> $Old_Day = 5; >> $Old_Month = Feb. >> >> And then I convert Feb to 2 ( Month number ) by using scalar veriable. ( >> The thing repeated for all months ). >> >> if( $Old_Month eq Feb) >> { >> $Old_Month = "2"; >> } >> elsif($Old_Month eq Mar ) >> { >> $Old_Month = "3"; >> } >> ..... >> elsif($Old_Month eq Dec ) >> { >> $Old_Month = "13"; >> } >> >> And in current month, which I got from localtime function as, >> >> $Current_Month , which will be 2 ( not sure this is a string or a >> numric >> ). >> >> so while substracting or comparing as below, >> >> if (($current_Month - $Old_Month > 10) ) >> { >> print " Some operation "; >> } >> >> Here if I compare with current month with the old_month (Feb) then the >> result is fine. >> but if the old_month is something like Jan or Jun something, then I am >> not >> getting the properl result. >> >> Please let me know how can I compare and Substract two months or two >> dates >> in above scenario. >> >> Thanks a lot for your kind help. >> >> Regards, >> Mujju >> >> > ---------------------------------------------------------------------------- -- > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H_______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > -- Nigel Reed Candidate for Lieutenant Governor of Marketing 2009-2010 President & CEO Sysadmin, Inc 972 673 4199 http://www.sysadmininc.com Toastmasters District 50 Vista Division Governor 2008-2009 Awareness, Attitude and Action bring Achievement! |
From: Nigel R. <ni...@sy...> - 2009-03-09 19:45:53
|
Can someone explain why I am getting the following error message? Channel open failure: 10: reason 1: open failed Basically, I'm opening a connection successfully to a server, then I'm feeding commands, it handles the first 9 without a problem and then chokes. Any suggestions appreciated. Regards Nigel -- Nigel Reed Candidate for Lieutenant Governor of Marketing 2009-2010 President & CEO Sysadmin, Inc 972 673 4199 http://www.sysadmininc.com Toastmasters District 50 Vista Division Governor 2008-2009 Awareness, Attitude and Action bring Achievement! |
From: Courtlyn M. <cmc...@gm...> - 2009-03-03 22:00:10
|
I've been using Net::SSH2 0.18 with libssh2 1.0 on Solaris 5.10 to pull back log files from remote servers for a couple of weeks now. I recently added some Red Hat servers into the client list and I ran into a segfault right after I issued the connect statement. I was able to back trace the core and it showed an out of bounds problem with the default aes256-cbc crypt. After I declared a crypt I was able to connect to these servers without a problem. The trace is below for those that are interested, I can also include a snippet of the code if needed. I'm now passing a list of crypts without aes256-cbc, but I've tested and if aes256-cbc is the first choice in the lineup it won't be gracefully passed over. Does anyone know of a way I can either test for incompatibilities before the segfault or at least capture the failure and retry with a different crypt rather then core dumping? Thanks, Cory Program terminated with signal 11, Segmentation fault. #0 0x00000000 in ?? () (gdb) bt #0 0x00000000 in ?? () #1 0xfee2b4a4 in _libssh2_cipher_init (h=0x228bc8, algo=0x228bc8, iv=0xfffffff8 <Address 0xfffffff8 out of bounds>, secret=0xffffffff <Address 0xffffffff out of bounds>, encrypt=0) at openssl.c:171 #2 0xfee17e70 in _libssh2_init (session=0x57900, method=0xfee3f584, iv=0x2a180 "¬Úátò226ú¤P:ô", free_iv=0xffbff51c, secret=0x229858 "æ07\005P+Ç®\177 \226\2054\230\001\223Y&ö020\031_+\234ÿ\035Â\034[\215´'ߺ\fã", free _secret=0xffbff518, encrypt=1, abstract=0xfee2b494) at crypt.c:87 #3 0xfee195a0 in libssh2_kex_method_diffie_hellman_groupGP_sha1_key_exchange ( session=0x57900, g=0x36d8a0, p=0x36d880, group_order=172416, packet_type_init=76 'L', packet_type_reply=196 'Ä, midhash=0xffbff520 "\020\031_+\234ÿ\035Â\034[\215´'ߺ\fã", midhash_len=0, exchange_state=0x58bb4) at kex.c:494 #4 0xfee19930 in libssh2_kex_method_diffie_hellman_group14_sha1_key_exchange ( session=0x57900, key_state=0x58ba8) at kex.c:785 #5 0xfee1a500 in libssh2_kex_exchange (session=0x57900, reexchange=2259352, key_state=0x58b9c) at kex.c:1770 #6 0xfee21b60 in libssh2_session_startup (session=0x57900, sock=358656) at session.c:588 #7 0xfee58e88 in XS_Net__SSH2__startup () from /usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/Net/SSH2/SSH2.so #8 0xff2a757c in Perl_pp_entersub () from /usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE/libperl.so.1 #9 0xff2e28dc in Perl_runops_standard () from /usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE/libperl.so.1 #10 0xff268ab4 in S_run_body () from /usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE/libperl.so.1 #11 0xff268610 in perl_run () from /usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE/libperl.so.1 #12 0x00011038 in main () (gdb) |
From: Nigel R. <ni...@sy...> - 2009-03-03 15:57:22
|
I had a similar issue. Doing a search, there was another module that should be installed to speed things up. It was either Math::BigInt and/or Math::BigInt::GMP Try installing those and see if it makes a difference. Regards Nigel Thomas Lorenzen wrote: > > Hi' > > > > I am targeting a simple perl loop, in which I with ssh->cmd will > execute a command on a remote host. This code should run in the back > ground on the mother host. > > > > The following simple code shows my observation. > > > > ##### > > use Net::SSH::Perl; > > > > $host = Net::SSH::Perl->new("remotehost"); > > $host->login(); > > > > while (1) { > > print `date`; > > ($out, $err, $exit) = $host->cmd("sleep 10"); > > } > > ##### > > > > Now, call the code test.pl and run "./test.pl". Command "top" running > in another shell on the mother host does not show anything suspicious. > Now I would like to have the code running in the background and thus I > do "./test.pl </dev/null 1>/dev/null 2>/dev/null &". Now > the "top" command shows my little program eating up one full processor. > This puzzles me very much indeed and I am speculating, if this is a bug > or a feature. > > > > Thanks for any help in advance. > > > > Best regards. > > > > Thomas. > > > ___________________________________________________________ > Skal du købe ny bil? Sammenlign priser på brugte biler med Kelkoo og find > et godt tilbud! - Se mere her > http://dk.yahoo.com/r/pat/mmb------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H_______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > -- Nigel Reed Candidate for Lieutenant Governor of Marketing 2009-2010 President & CEO Sysadmin, Inc 972 673 4199 http://www.sysadmininc.com Toastmasters District 50 Vista Division Governor 2008-2009 Awareness, Attitude and Action bring Achievement! |
From: Thomas L. <ki1...@ya...> - 2009-03-03 11:59:35
|
Hi' I am targeting a simple perl loop, in which I with ssh->cmd will execute a command on a remote host. This code should run in the back ground on the mother host. The following simple code shows my observation. ##### use Net::SSH::Perl; $host = Net::SSH::Perl->new("remotehost"); $host->login(); while (1) { print `date`; ($out, $err, $exit) = $host->cmd("sleep 10"); } ##### Now, call the code test.pl and run "./test.pl". Command "top" running in another shell on the mother host does not show anything suspicious. Now I would like to have the code running in the background and thus I do "./test.pl </dev/null 1>/dev/null 2>/dev/null &". Now the "top" command shows my little program eating up one full processor. This puzzles me very much indeed and I am speculating, if this is a bug or a feature. Thanks for any help in advance. Best regards. Thomas. ___________________________________________________________ Skal du købe ny bil? Sammenlign priser på brugte biler med Kelkoo og find et godt tilbud! - Se mere her http://dk.yahoo.com/r/pat/mmb |
From: Nigel R. <ni...@sy...> - 2009-02-24 18:49:01
|
Three suggestions. 1) Use the Date::Calc module 2) Post to a list for general PERL questions, not one for Net::SSH::Perl 3) Pick up a copy of Perl Programming Oh, here's a free one, Dec is the 12th month. %mon2num = qw( Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6 Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec 12 ); $monthtext="Feb"; $monthnum = $mon2num{"$monthtext"}; Perl Perl wrote: >> >> Dear All, >> >> I have to compare two dates. And populate the result based on >> that. >> First date I have received from previous script, which in this form >> 5-Feb-09. >> And I have to compare this date with current date, locatime() . With the >> localtime() I will get the current Day (24),Month (2) & year (2009 ) >> >> I will split the old date as below and get the result as below. >> >> $Old_Day = 5; >> $Old_Month = Feb. >> >> And then I convert Feb to 2 ( Month number ) by using scalar veriable. ( >> The thing repeated for all months ). >> >> if( $Old_Month eq Feb) >> { >> $Old_Month = "2"; >> } >> elsif($Old_Month eq Mar ) >> { >> $Old_Month = "3"; >> } >> ..... >> elsif($Old_Month eq Dec ) >> { >> $Old_Month = "13"; >> } >> >> And in current month, which I got from localtime function as, >> >> $Current_Month , which will be 2 ( not sure this is a string or a >> numric >> ). >> >> so while substracting or comparing as below, >> >> if (($current_Month - $Old_Month > 10) ) >> { >> print " Some operation "; >> } >> >> Here if I compare with current month with the old_month (Feb) then the >> result is fine. >> but if the old_month is something like Jan or Jun something, then I am >> not >> getting the properl result. >> >> Please let me know how can I compare and Substract two months or two >> dates >> in above scenario. >> >> Thanks a lot for your kind help. >> >> Regards, >> Mujju >> >> > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H_______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > -- Nigel Reed Candidate for Lieutenant Governor of Marketing 2009-2010 President & CEO Sysadmin, Inc 972 673 4199 http://www.sysadmininc.com Toastmasters District 50 Vista Division Governor 2008-2009 Awareness, Attitude and Action bring Achievement! |
From: Perl P. <per...@gm...> - 2009-02-24 18:09:34
|
> > Dear All, > > I have to compare two dates. And populate the result based on > that. > First date I have received from previous script, which in this form > 5-Feb-09. > And I have to compare this date with current date, locatime() . With the > localtime() I will get the current Day (24),Month (2) & year (2009 ) > > I will split the old date as below and get the result as below. > > $Old_Day = 5; > $Old_Month = Feb. > > And then I convert Feb to 2 ( Month number ) by using scalar veriable. ( > The thing repeated for all months ). > > if( $Old_Month eq Feb) > { > $Old_Month = "2"; > } > elsif($Old_Month eq Mar ) > { > $Old_Month = "3"; > } > ..... > elsif($Old_Month eq Dec ) > { > $Old_Month = "13"; > } > > And in current month, which I got from localtime function as, > > $Current_Month , which will be 2 ( not sure this is a string or a numric > ). > > so while substracting or comparing as below, > > if (($current_Month - $Old_Month > 10) ) > { > print " Some operation "; > } > > Here if I compare with current month with the old_month (Feb) then the > result is fine. > but if the old_month is something like Jan or Jun something, then I am not > getting the properl result. > > Please let me know how can I compare and Substract two months or two dates > in above scenario. > > Thanks a lot for your kind help. > > Regards, > Mujju > > |
From: Perl P. <per...@gm...> - 2009-02-24 18:06:48
|
Dear All, I have to compare two dates. And populate the result based on that. First date I have received from previous script, which in this form 5-Feb-09. And I have to compare this date with current date, locatime() . With the localtime() I will get the current Day (24),Month (2) & year (2009 ) I will split the old date as below and get the result as below. $Old_Day = 5; $Old_Month = Feb. And then I convert Feb to 2 ( Month number ) by using scalar veriable. ( The thing repeated for all months ). if( $Old_Month eq Feb) { $Old_Month = "2"; } elsif($Old_Month eq Mar ) { $Old_Month = "3"; } ..... elsif($Old_Month eq Dec ) { $Old_Month = "13"; } And in current month, which I got from localtime function as, $Current_Month , which will be 2 ( not sure this is a string or a numric ). so while substracting or comparing as below, if (($current_Month - $Old_Month > 10) ) { print " Some operation "; } Here if I compare with current month with the old_month (Feb) then the result is fine. but if the old_month is something like Jan or Jun something, then I am not getting the properl result. Please let me know how can I compare and Substract two months or two dates in above scenario. Thanks a lot for your kind help. Regards, Mujju |
From: Perl P. <per...@gm...> - 2009-02-23 12:10:13
|
Hi All, I have to read a file by using hash ( Associative array) . Here I have to grep the particular information from that file. Like file is having the data like Date (2-Jan-2008) and user id ( MID1023 ) etc. These all information is there for number of people in different lines. My task is to grep the data, which is as mention above. And I have to make sure that I have to use Hash ( Associative array only ). Your help will be greately appreciated. Thanks, Mujju |
From: Stefan A. <ste...@gm...> - 2009-02-18 09:25:28
|
>From Russ Brewer > Stefan, > > eval { > my ($stdout, $stderr, $exit) = $ssh->cmd(BashScript); > > @sdtout_result = split(/\n/, $stdout); > @stderr_result = split(/\n/, $stderr); > $BashScript_exit_status = $exit; > }; > > if (($BashScript_exit_status ne 0) || ($@)) > # then there was a problem > > if ($@) { > print "\$@ = $@\n"; > } else { > print "ERROR: remote script exit status = > $BashScript_exit_status\n"; > } > > foreach (@stderr_result) { > print "$_\n"; > } > > } else { > > # No error was detected > foreach (@stdout_result) { > print "$_\n"; > } > } > The script idea itself works, but it does not solve my problem. I will explain my problem again in detail at the bottom. > I have not used the register_handler command because the above code gets me > what I need. > Be sure to program BashScript to exit with a non_zero value if it encounters > an error while running on the remote server. > > You can also program BashScript to run STDERR error free when it encounters > no run problem and then test @stderr_result for content. If content exists, > something went wrong. The exception might be an FTP command which utilizes > the STDERR channel for routine FTP communication. I like to write BashScript > to log its own errors remotely and then have it check that log for size. If > the remote error log holds content then terminate BashScript with exit(1) > instead of exit(0). > > I hope this helps. I works for me. > > > Russ Brewer > > > Original Post >> >> I'm running Net::SSH::Perl 1.34. >> >> I execute a bash-script via ssh on a remote server. >> >> I register two handles for stdout and stderr: >> >> $ssh->register_handler( >> "stdout", >> sub { >> my ( $channel, $buffer ) = @_; >> print $buffer->bytes; >> print LOGFILE $buffer->bytes; >> } >> ); >> $ssh->register_handler( >> "stderr", >> sub { >> my ( $channel, $buffer ) = @_; >> print $buffer->bytes; >> print LOGFILE $buffer->bytes; >> } >> ); >> >> Then is send my command with: >> >> $ssh->cmd("BashScript"); >> >> wait until it finishes. >> >> The question I have is: >> >> How do I detect a connection loss? >> >> The script on the remote server my take a very long time without any >> activity on the console. >> >> I have tried invoking my connection with "options => [ >> "ServerAliveInterval 15 ServerAliveCountMax 10" ]" or "options => [ >> "BatchMode yes" ]". However whenever I test it, by pulling out the >> network cable while the script runs, it just sits there. The longest I >> have waited is 45 min until I aborted manually. >> >> Shouldn't the connection be checked every 300 seconds with "BatchMode >> yes"? >> >> Any help would be appreciated. >> >> >> ------------------------------------------------------------------------------ >> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, >> CA >> -OSBC tackles the biggest issue in open source: Open Sourcing the >> Enterprise >> -Strategies to boost innovation and cut costs with open source >> participation >> -Receive a $600 discount off the registration fee with the source code: >> SFAD >> http://p.sf.net/sfu/XcvMzF8H >> _______________________________________________ >> Ssh-sftp-perl-users mailing list >> Ssh...@li... >> https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > Okay: I have two machines. One runs the perl script. The script connects through ssh and runs a bash script on the second machine. This bash script can run quiet some time without giving back any feed back, but it still runs. Here is the example how I would run it directly from the command line with ssh: ssh -o "ServerAliveInterval 15" user@2ndMachine /home/user/BashScript.sh One thing that is important for me, is to detect if I'm still connected to the server. If I run it in the command line as described and pull the network cable on the second machine, I get after some time a time out. This is a desired behavior for me. I have tried the same thing with a perl script. Heres an example script: #!/usr/bin/perl -w use strict; use warnings; use Net::SSH::Perl; { my $ssh = Net::SSH::Perl->new( "2ndMachine", protocol => 2, options => [ "ServerAliveInterval 15"] ); $ssh->login("user", "password"); my @sdtout_result; my @stderr_result; my $BashScript_exit_status; eval { my ($stdout, $stderr, $exit) = $ssh->cmd("/srv/import/bin/backup_topsis.sh"); @sdtout_result = split(/\n/, $stdout); @stderr_result = split(/\n/, $stderr); $BashScript_exit_status = $exit; }; if (($BashScript_exit_status ne 0) || ($@)) # then there was a problem { if ($@) { print "\$@ = $@\n"; } else { print "ERROR: remote script exit status = $BashScript_exit_status\n"; } foreach (@stderr_result) { print "$_\n"; } } else { # No error was detected foreach ( @sdtout_result ) { print "$_\n"; } } } In this case, however, I do not get a time out if I pull the network cable on the second machine. The script will just sit there forever. It is important for me to detect network errors and in this case I can not detect them. I do not have a problem detecting the exit code of the remote script. That is already possible. I have used the handler method (see first post), because I wanted a continuous output of the progress of the remote script. If anyone has an idea how I can detect any network errors, it would be great. Stefan |
From: Russ B. <us...@gm...> - 2009-02-17 14:23:27
|
Stefan, eval { my ($stdout, $stderr, $exit) = $ssh->cmd(BashScript); @sdtout_result = split(/\n/, $stdout); @stderr_result = split(/\n/, $stderr); $BashScript_exit_status = $exit; }; if (($BashScript_exit_status ne 0) || ($@)) # then there was a problem if ($@) { print "\$@ = $@\n"; } else { print "ERROR: remote script exit status = $BashScript_exit_status\n"; } foreach (@stderr_result) { print "$_\n"; } } else { # No error was detected foreach (@stdout_result) { print "$_\n"; } } I have not used the register_handler command because the above code gets me what I need. Be sure to program BashScript to exit with a non_zero value if it encounters an error while running on the remote server. You can also program BashScript to run STDERR error free when it encounters no run problem and then test @stderr_result for content. If content exists, something went wrong. The exception might be an FTP command which utilizes the STDERR channel for routine FTP communication. I like to write BashScript to log its own errors remotely and then have it check that log for size. If the remote error log holds content then terminate BashScript with exit(1) instead of exit(0). I hope this helps. I works for me. Russ Brewer On Tue, Feb 17, 2009 at 7:15 AM, Stefan Adling <ste...@gm...>wrote: > I'm running Net::SSH::Perl 1.34. > > I execute a bash-script via ssh on a remote server. > > I register two handles for stdout and stderr: > > $ssh->register_handler( > "stdout", > sub { > my ( $channel, $buffer ) = @_; > print $buffer->bytes; > print LOGFILE $buffer->bytes; > } > ); > $ssh->register_handler( > "stderr", > sub { > my ( $channel, $buffer ) = @_; > print $buffer->bytes; > print LOGFILE $buffer->bytes; > } > ); > > Then is send my command with: > > $ssh->cmd("BashScript"); > > wait until it finishes. > > The question I have is: > > How do I detect a connection loss? > > The script on the remote server my take a very long time without any > activity on the console. > > I have tried invoking my connection with "options => [ > "ServerAliveInterval 15 ServerAliveCountMax 10" ]" or "options => [ > "BatchMode yes" ]". However whenever I test it, by pulling out the > network cable while the script runs, it just sits there. The longest I > have waited is 45 min until I aborted manually. > > Shouldn't the connection be checked every 300 seconds with "BatchMode yes"? > > Any help would be appreciated. > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > |
From: Stefan A. <ste...@gm...> - 2009-02-17 12:15:54
|
I'm running Net::SSH::Perl 1.34. I execute a bash-script via ssh on a remote server. I register two handles for stdout and stderr: $ssh->register_handler( "stdout", sub { my ( $channel, $buffer ) = @_; print $buffer->bytes; print LOGFILE $buffer->bytes; } ); $ssh->register_handler( "stderr", sub { my ( $channel, $buffer ) = @_; print $buffer->bytes; print LOGFILE $buffer->bytes; } ); Then is send my command with: $ssh->cmd("BashScript"); wait until it finishes. The question I have is: How do I detect a connection loss? The script on the remote server my take a very long time without any activity on the console. I have tried invoking my connection with "options => [ "ServerAliveInterval 15 ServerAliveCountMax 10" ]" or "options => [ "BatchMode yes" ]". However whenever I test it, by pulling out the network cable while the script runs, it just sits there. The longest I have waited is 45 min until I aborted manually. Shouldn't the connection be checked every 300 seconds with "BatchMode yes"? Any help would be appreciated. |
From: Thierry C. <thi...@gm...> - 2009-02-04 12:55:10
|
Le mercredi 04 février 2009, Vikas Poonia a écrit : > Hello > > How to convert date from one format to another. I am getting this type > (12.01.2009 00.00.00) of value in a variable. Is there any way where I can > convert it into 200901 means only year and month. > > Thanks and Regards > Vikas Poonia This problem can be solve easily with some Date modules in CPAN, but it is not a problem related to Net::SSH:Perl. Please, use a less specific mailing list if you want an answer. |
From: Vikas P. <vik...@ya...> - 2009-02-04 12:15:03
|
Hello How to convert date from one format to another. I am getting this type (12.01.2009 00.00.00) of value in a variable. Is there any way where I can convert it into 200901 means only year and month. Thanks and Regards Vikas Poonia |