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

phiroc@REDACTED phiroc@REDACTED
Mon May 23 16:55:42 CEST 2011


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" <carlo.bertoldi@REDACTED>
À: erlang-questions@REDACTED
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, phiroc@REDACTED 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
erlang-questions@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list