Attaching a shell to a running node.

Rick Pettit rpettit@REDACTED
Thu Aug 17 22:49:34 CEST 2006

On Thu, Aug 17, 2006 at 04:32:06PM -0400, Serge Aleynikov wrote:
> In the embedded mode you need to start the node using "run_erl" command, 
> and use "to_erl" to attach to the node's console.
> See:
> This is a preferred way for running embedded systems in production. 
> Another benefit here is that all console activity gets logged in this 
> mode, and run_erl takes care of file rotations.
> If you don't need to access the node's console, but just need to run a 
> shell on a remote node, you can start a non-embedded node and use the 
> -remsh option:
> $ erl -sname b -remsh a@REDACTED
> Erlang (BEAM) emulator version 5.5 [source] [async-threads:0] [hipe] 
> [kernel-poll:false]
> Eshell V5.5  (abort with ^G)
> (a@REDACTED)1>

Another option is to use non-embedded node and make decision to remote into
another node after startup (i.e. without having used -remsh) by using CTL-G
and doing:

  rpettit>erl -name n1 -setcookie foo
  Erlang (BEAM) emulator version 5.3 [source]

  Eshell V5.3  (abort with ^G)
  (n1@REDACTED)1> net_adm:ping('n2@REDACTED').
  (n1@REDACTED)2>  % I hit CTL-G here
  User switch command
   --> r 'n2@REDACTED'
   --> j
     1  {}
     2  {shell,start,[]}
     3* {'n2@REDACTED',shell,start,[]}
   --> c 3
  Eshell V5.3  (abort with ^G)
  (n2@REDACTED)1> % on remote node, about to switch back
  (n2@REDACTED)1> % I hit CTL-G here
  User switch command
   --> c 2    % I hit enter twice here (to get prompt to print)
  (n1@REDACTED)2> q().

You can start multiple remote shells and juggle sessions that way (just make
sure you pay attention to what node you are on before running arbitrary
commands :-)


> Serge Aleynikov
> R&D Telecom, MIS, IDT Corp
> Tel: +1 (973) 438-3436
> Fax: +1 (973) 438-1464
> Eric Merritt wrote:
> >In the release handling how to on trap exit there is a sentance that
> >caught my attention.
> >
> >"There are tricks for starting an embedded system and being able to
> >attach a shell to a node, but that's another tutorial."
> >
> >So my question is, how do you attach a shell to a node?
> >
> >Thanks,
> >Eric
> >
> -- 

More information about the erlang-questions mailing list