[erlang-questions] Remote command execution via SSH ?

Michael Truog mjtruog@REDACTED
Tue Aug 14 00:57:06 CEST 2012


On 08/13/2012 02:54 PM, Thomas Elsgaard wrote:
> Hi
>
> Does anybody have a good simple example of executing commands on a
> remote server via SSH?
>
> Nothing fancy, just something like:
>
> ------
> Connect to host
> Execute command '/bin/ls'
> Read output from command
> Close connection
> ------
>
Just do:

|slave:start_link('nodename', 'user', "-rsh ssh").

See:
http://www.erlang.org/doc/man/slave.html
http://stackoverflow.com/questions/2658912/erlang-starting-slave-node

Keep in mind that your ssh configuration needs to be set, so you really should test it outside of Erlang before attempting the login within Erlang.  Tsung does this for client machines if you wanted to see a production example (|||http://tsung.erlang-projects.org/|).
|


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120813/b4baf36e/attachment.htm>


More information about the erlang-questions mailing list