Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Remote Execution Perl

by chronic19 (Initiate)
on Aug 10, 2005 at 22:10 UTC ( #482784=perlquestion: print w/ replies, xml ) Need Help??
chronic19 has asked for the wisdom of the Perl Monks concerning the following question:

I'm creating a CGI form that will allow users to execute Perl scripts on remote servers (Server is not the same as the CGI), is the only way to do t his through SSH (system command, Net::SSH, etc...) or is there a built in RPC logic in perl. Thanks

Comment on Remote Execution Perl
Re: Remote Execution Perl
by ikegami (Pope) on Aug 10, 2005 at 22:31 UTC
    You need to have a deamon on the remote server capable of launching the Perl script, and you need to be able to talk to that deamon. SSH deamons, HTTP deamons, HTTPS deamons, FTP deamons and many others match these criteria. It's up to you to choose the one that suits you best. Some are friendlier to firewalls than others (HTTP and HTTPS), some allow interaction (SSH), etc.
      Just remembered that you may also use rlogin, and some people may shoot me in the head for mentioning this. rlogin is obsolete and poses a great security risk! However I've seen rlogin being used in quite a few places (for e.g. DB2 parallel installations use rlogin to execute commands).
        ssh can do everything rlogin can, but it's safer. One should stay away from rlogin unless commanded otherwise, and even then only after a fight.
Re: Remote Execution Perl
by fmerges (Chaplain) on Aug 10, 2005 at 23:57 UTC

    Hi,

    As stated ikegami, you will need to run a server on the other side, which will launch/executes the other processes by forking/threading.

    A simple example would be a daemon/webservice which listen on a given port, the cgi contact with this daemon and do RPC to instruct the remote process what program or actions to do. For communication between this two processes I would recommend you XML-RPC, it's very simple with the benefits that the information is xml -> text, so the debugging is very simple. If you need some security above this you could make the communication through a secure tunel.

    Take a look at the website, there is a very good howto with code examples for the most used programming languages

    I don't really know how complex is the thing you are creating, but if you have a Jabber server inside your company, or had think about using one, you could also use the Jabber server as a message-server for passing the RPC calls to the remote process that is online in the Jabber server, with the benefits that the process is like a service or client of the Jabber server, and having all the security/reliability that the Jabber server can give you... only a idea, but... could be interesting for you. So you can "talk" with the service/client as it were a human. ;-)

    Regards,

    |fire| at irc.freenode.net
Re: Remote Execution Perl
by linuxfan (Beadle) on Aug 11, 2005 at 00:03 UTC
    I've used Net::SSH::Perl with great success to run commands on remote Linux machines. To compile the required set of RPMs for this module took quite a while, but it was worth the effort.

    You may also look at STAF. I believe it has a model that lets you execute jobs on remote machines.

Re: Remote Execution Perl
by salva (Monsignor) on Aug 11, 2005 at 08:55 UTC
    my old sperl script is able to run simple perl scripts and one-liners on remote machines via ssh, i.e.:
    $ sperl bugs,willy,hippo -e \ 'chomp($h=`hostname`);print "hello from $h!!!\n"' hello from bugs!!! hello from willy!!! hello from hippo!!!
Re: Remote Execution Perl
by ambrus (Abbot) on Aug 11, 2005 at 11:42 UTC

    The simplest way may indeed be the ssh command. The disadvantage of it is that it may be slower than other solutions.

Re: Remote Execution Perl
by casiano (Pilgrim) on Jul 21, 2007 at 11:02 UTC
    I have written a module GRID::Machine which provides RPC for Perl on top of a SSH connection.

    It seems that it could be appropriate for the kind of problem you have. I hope it can help.

    Casiano

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (16)
As of 2014-09-17 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (80 votes), past polls