How to execute a perl script at remote server



Hi All,



I have written a Perl script, which deals with the ftp ing
(transferring) the file to remote server and executing a Perl script
(AUT) at remote m/c.

The script is as below and here I have 2 doubts, so please help me to
resolve this.



1) I am getting the message like "could not transfer the file to
server" but it is ftp ing the flie to remote m/c, and I can see that
file ( root1.txt ) there.

2) And I want to run the perl script (AUT) at remote m/c depending
on the data we sent, so could you please let me know how can I achieve
this.

Is it possible for me to do system("test.pl"), If I am at SFTP mode.
Please see comment line in the code below.



#!/usr/bin/perl -w



use strict;

use warnings;

use Net::SFTP;



my $server="A.BY.C.D";



my $user="roserag";



my $password="june@123";



my %args = (user => "$user", password => "$password", ssh_args => []);



$args{debug} = 1;



$args{user} = "root";



my $file="local.txt";

my $rfile = "root1.txt";



my $sftp=Net::SFTP->new($server, %args) or die "could not open
connection to $server\n";



$sftp->put($file,$rfile) or die " could not transfer the file to server
\n";



# system("test.pl"); Is this command work out.

exit;







[gaurav@testbrix Examples]$ perl sftp3.pl

testbrix.wipro.com: Reading configuration data /home/gaurav/.ssh/config

testbrix.wipro.com: Reading configuration data /etc/ssh_config

....................................

....................................

testbrix.wipro.com: sftp: In write loop, got 510 offset 0

testbrix.wipro.com: sftp: Sent message T:10 I:2

testbrix.wipro.com: sftp: Sent message T:4 I:3

could not transfer the file to server



But I can see the file the file at server.




1,1 All

Regards,

Mustafa




Please do not print this email unless it is absolutely necessary.

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com


Relevant Pages

  • Re: How Can I use ssh in my perl code
    ... at remote m/c, which we can do with ssh. ... connecting to remote m/c once we execute the perl script through ssh. ... The information contained in this electronic message and any attachments to ...
    (perl.dbi.users)
  • RE: Passing Data Between Servers
    ... Then your server code is run by placing '|myperlcode -w' into ... >> then just send out to another perl script that would be ... >> Then based on the contents of input lunch another perl ... > something just waiting ...
    (perl.beginners)
  • Re: connect to a remote Postgresql server using DBI
    ... else) to execute queries on the remote database. ... perl script to execute queries on the remote server? ... > See the bottom of this page for client installation ...
    (perl.dbi.users)
  • Re: LDAP in SBS 2003?
    ... With that perl script, I can add any formatting the program requires or whatever. ... The point is the script generates the list and the connection to update the necessary server is OUTGOING, ... I either maintain a separate list of email addresses on the outside server, or I set up the outside server to perform LDAP queries on the SBS box. ...
    (microsoft.public.windows.server.sbs)
  • Email server timing out in email script
    ... I have a perl script running on machine A, ... The email is sent by machine B which is the email server for the domain. ... more than 80 seconds to run, and most of that is timeout. ... Following is the closure part of the log. ...
    (comp.lang.perl)