Re: [Ssh-sftp-perl-users] Problem using Net::SSH::Perl
Brought to you by:
dbrobins
From: Sant'Anna, P. \(IT\) <Pau...@mo...> - 2007-01-12 19:12:38
|
Does this command hangs the terminal also if you execute directly on the Unix box? You can try the following to detach it from the terminal =20 $ssh->cmd("nohup service snmpd start"); =20 Thanks, =20 -- Paulo ________________________________ From: Chakresh Yadav [mailto:cy...@ns...]=20 Sent: Friday, January 12, 2007 1:36 PM To: Sant'Anna, Paulo (IT); ssh...@li... Subject: RE: [Ssh-sftp-perl-users] Problem using Net::SSH::Perl Thanks for prompt reply. I tried this piece of code but don't see pl script exiting on the windows box. The command is successfully executed on the remote Unix server. =20 I go to the unix box and stop the service and then perl script exits successfully. =20 Does this give any clue what's going on ??? =20 I tried giving the command "touch /tmp/abc.txt" and the file is created on unix server and perl scipt also exits. Why perl script behaves differently for these 2 different commands on remote box ? =20 Thanks Chakresh =20 =20 ________________________________ From: Sant'Anna, Paulo (IT) [mailto:Pau...@mo...]=20 Sent: Friday, January 12, 2007 7:21 AM To: cy...@ns...; ssh...@li... Subject: RE: [Ssh-sftp-perl-users] Problem using Net::SSH::Perl =20 I don't think the connection is dropped after a command is send. You might want to add: =20 $ssh->cmd("exit"); =20 to your script to close the connection. =20 Thanks, =20 -- Paulo =20 =20 ________________________________ From: ssh...@li... [mailto:ssh...@li...] On Behalf Of Chakresh Yadav Sent: Thursday, January 11, 2007 9:55 PM To: ssh...@li... Subject: [Ssh-sftp-perl-users] Problem using Net::SSH::Perl Hi, =20 I am running a simple script to execute a command on a remote linux server. The machine on which pl script is running is windows XP (no cygwin installed). Below is the script and output =20 #testing script use Net::SSH::Perl; =20 $targetIP =3D shift; $userName =3D shift; $password =3D shift; $sourceFileName =3D shift; $destinationDir =3D shift; =20 my $ssh =3D Net::SSH::Perl->new($targetIP, debug=3D>1); $ssh->login($userName,$password); =20 $ssh->cmd("service snmpd start"); =20 print "Bye"; =20 The debug output is=20 =20 ChakreshYadavPC: Reading configuration data /.ssh/config ChakreshYadavPC: Reading configuration data /etc/ssh_config ChakreshYadavPC: Connecting to 192.168.1.203, port 22. ChakreshYadavPC: Remote version string: SSH-1.99-OpenSSH_3.5p1 =20 ChakreshYadavPC: Remote protocol version 1.99, remote software version OpenSSH_3 .5p1 ChakreshYadavPC: Net::SSH::Perl Version 1.30, protocol version 1.5. ChakreshYadavPC: No compat match: OpenSSH_3.5p1. ChakreshYadavPC: Connection established. ChakreshYadavPC: Waiting for server public key. ChakreshYadavPC: Received server public key (768 bits) and host key (1024 bits). =20 ChakreshYadavPC: Host '192.168.1.203' is known and matches the host key. ChakreshYadavPC: Encryption type: DES3 ChakreshYadavPC: Sent encrypted session key. ChakreshYadavPC: Received encryption confirmation. ChakreshYadavPC: RSA authentication failed: Can't load public key. ChakreshYadavPC: Doing challenge response authentication. ChakreshYadavPC: No challenge presented. ChakreshYadavPC: Trying password authentication. ChakreshYadavPC: Sending command: service snmpd start ChakreshYadavPC: Entering interactive session. =20 =20 The scipt does not exit after sending command to remote box. I can see service "snmpd" running on remote Unix server but no message "Bye" on windows box. =20 Does anyone has faced this issue ? Any pointers will be highly appreciated as I need this script to run ASAP. =20 Thanks Chakresh =20 =20 =20 =20 =20 ________________________________ NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender = does not intend to waive confidentiality or privilege. Use of this email = is prohibited when received in error. |