[erlang-questions] Running an erl program on a remote machine

Angel Alvarez <>
Tue May 24 09:57:45 CEST 2011


Use the slave module

you can start an erlang vm on a remote host using SSH and a provided you have transfered yout erlang code there you can run 
remote process.

Also you can load locally your code and send it to remote nodes via binaries or use the remote code server option on the slave modules...

Just to start:
erl -man slave

On the code server:
erl -man code



/Angel

El Lunes, 23 de Mayo de 2011 16:55:42  escribió:
> 
> Hi,
> 
> I have been asked to write a script which runs database commands on one of n 
> mirror machines. The name of the machine the commands should be run on is
> contained in a DNS alias called, say, THE_CURRENT_MACHINE. In other words,
> if the THE_CURRENT_MACHINE alias resolves to machineA.company.com,
>  then the script should be run on that machine, if it resolves to
>  machineB.company.com, it should run on machine b, etc.
> 
> I have thought of several ways of doing the above:
> 
> - run a PERL script at a set time each day on a machine which I will call
> machinex, which resolves the THE_CURRENT_MACHINE alias, connects to 
> it via SSH and runs the database commands. The disadvantage of 
> this solution is that, if machinex is down, the PERL script won't be run.
> 
> - run a PERL script at a set time each day on machines A and B (and C and D...) 
> makes sure that the current machine's name is equal to THE_CURRENT_MACHINE value,
> and, if that is the case, runs the database commands.
> The disadvantage of this solution is that if I have 10 machines, I 
> must duplicate the script on those ten machines.
> 
> - write an Erlang program which create a remote process on THE_CURRENT_MACHINE that 
> runs the database commands, if it is feasible. Once again, if machinex is down,
> the program won't be run.
> 
> - write an Erlang script which will run as a daemon on machines A, B, C...
> which checks every second if the time matches the time at which the database 
> commands should be triggered, and, if that is the case, run them. 
> 
> If I had never heard of Erlang and of its alleged "spawn a remote process" capabilities,
> I would opt for solution 2 above. If you fellows have a better solution, please let me know.
> 
> Philippe
> 
> 
> 
> 
> ----- Mail Original -----
> De: "Carlo Bertoldi" <>
> À: 
> Envoyé: Lundi 23 Mai 2011 16:20:24 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
> Objet: Re: [erlang-questions] Running an erl program on a remote machine
> 
> On 23/05/2011 16:12,  wrote:
> > Hello,
> >
> > is it possible to run an erlang program on a remote machine without using the erl console?
> >
> > For instance, let's say that I have written a program that runs a batch script and that I would like to run it on machine B at a set time. Can I create an entry in my machine's crontab which runs the following script:
> >
> > erl -name machineB -detached<the name of the erl script that runs the batch script>
> >
> Why would you want to do that?
> Why not put that command directly in B's crontab?
> 
>   Carlo
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
> 



-- 
Este correo no tiene dibujos. Las formas extrañas en la pantalla son letras.
__________________________________________

 Clist UAH a.k.a Angel AT uah DOT es

 Angel Alvarez , Servicios Informáticos
 Edificio Torre de Control, Campus Externo UAH
 Alcalá de Henares 28806, Madrid    
			    ** ESPAÑA **
__________________________________________
If debugging is the process of removing bugs, then programming must be the process of putting them in. - Dijkstra.



More information about the erlang-questions mailing list