Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: run perl script on remote server

by Rudolf (Monk)
on Sep 08, 2012 at 04:56 UTC ( #992427=note: print w/ replies, xml ) Need Help??


in reply to run perl script on remote server

Hello sumit07, so as far as I understand the main communication between you and the program will be happening through server C's command line and that the actual interaction will be going on between servers A and B. A would be manipulating the files in B. The first thing I would suggest is setting up something to listen on server A for incomming messages from you (c). I am not sure if these servers are on the same machine or LAN though it would not really matter there is more than one way to do it anyway.

After you set up a socket to listen for messages on A, you can create a sort of opcode for each function you want executed... maybe you might say "delete filex.txt" on C and that would get sent to A, where a regex can check socket for relevant opcodes and you can preform the function to server B accordingly.

Now this is all assuming you know how to work with sockets but if you do not, there are some easy ways like IO::Socket::INET or you can simply use socket; and build one from scratch. I also do not know what kind of servers your running but for machine to machine communication definetly look at sockets. If they are all on the same machine take a look at piping and other forms of inter process communication.


Comment on Re: run perl script on remote server
Re^2: run perl script on remote server
by sumit07 (Novice) on Sep 08, 2012 at 05:19 UTC
    thanks Rudolf for ur quick reply. First thing is that servers are in different machines. now to run perl script locally we write perl <filename> but in this case how to call it in remote machine could u plz clarify

      Ah, okay the clarification definetly helps. I do not believe there is any other way to send your command over to the server without using another piece of software however depending on the server type itself, you can set up something to listen for you and you can then write to that program ( via TCP connection ) something like you would regularly on your local machine- "perl <filename>" and if you can set up server A to run a system command of the collected data from the socket, it will send "perl <filename> to its local command line.

      It would be important to note what kind of servers they are? Also it would make things a lot easier if they were made out of perl hehe.

      Best of luck though, - Rudolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992427]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (15)
As of 2014-07-30 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (234 votes), past polls