Balakrishna
Balakrishna

Reputation: 53

How to invoke a perl script on the remote unix server from my local system

I have a perl script that should execute on the log files in the remote server from my local desktop. Could some one suggest me best approach.

I used Net::SFTP but there is a problem with installing SFTP package from CPAN. Is there any good package available in Perl to do this functionality?

Can you tell me whether the following steps are fine?

  1. Open SFTP connection with remote server
  2. execute the perl at remote location from the established connection.. Any sample code for this?

Upvotes: 1

Views: 1166

Answers (3)

Adam Taylor
Adam Taylor

Reputation: 7793

I'm not clear exactly what you are trying to achieve but if you just want to execute a Perl script on a remote server you may want to look at software specifically built for remote server management.

Tak is one such piece of software but it's quite new and a bit lacking in documentation.

Rex is a more mature, it would seem, piece of software for remote server management.

Both of these should allow you to run commands locally that perform actions remotely on your servers. I wouldn't have thought you'd need to do anything with SFTP and would think you could do it all with those or hand-rolling something with commands over SSH.

Upvotes: 1

salva
salva

Reputation: 10242

Instead of Net::SFTP, try using Net::SFTP::Foreign or, if you want to run commands on the remote host via SSH, Net::SSH2 or Net::OpenSSH .

Upvotes: 0

anomal
anomal

Reputation: 2299

If you mean that the Perl script is on the remote unix server and you want to invoke the Perl script from your local machine, then you can ssh into the remote unix server and then once you are connected, call your perl script using perl yourscript.pl.

If you mean that the Perl script is on your local machine and you are dealing with log files on the remote server, then it would be more efficient to have the Perl script located on the remote server that stores the logs, and invoke it in the way described in the above paragraph.

Upvotes: 1

Related Questions