[erlang-questions] Remote command execution via SSH ?

Tim Watson watson.timothy@REDACTED
Tue Aug 14 10:10:31 CEST 2012


On 13 Aug 2012, at 23:57, Michael Truog wrote:

> 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").

That works a treat if the node has Erlang installed under the same file system layout and one of two other constraints. If that isn't the case it fails. There is an ssh application with which you could wrap this up of course, and iirc a couple of people on github have started to put together projects to address this kind of thing, though I've no idea how complete or stable they are, nor indeed what the projects are called.

Slave module works well if the constraints don't bother you though - I use it a lot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120814/da4567b6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120814/da4567b6/attachment.bin>


More information about the erlang-questions mailing list