[erlang-questions] Problem attaching a shell to an Erlang node started through SSH

André Graf <>
Sat Jul 7 13:38:16 CEST 2012


Hi Ivan

Thank you for your reply!
Good question, maybe somebody more experienced can shed some light on that one.

Actually the main reason why I stumbled upon these problems is that I
wanted to start the node using the privbind tool for letting a
non-privileged run-user bind to privileged ports such as 80 or 443. If
I used fabric e.g.
sudo('privbind -u myuser /path/to/my/release/bin/myproject start',
pty=False) the fabric call froze my terminal since the privbind
process will terminate after the Erlang node has terminated (hopefully
never). At this point I have two problems: first, why behaves an
attached shell so weird if you start the node through SSH. Second how
to use privbind within a fabric command. For the first one I can well
live with the workaround through the remote shell. For the second
problem I am on the wrong mailing list.

Cheers,
André



On 7 July 2012 12:31, Ivan Uemlianin <> wrote:
> Dear André
>
> Sorry I made a typo in my email (never try to be helpful before breakfast;).
> I should have written:
>
>>> - this function calls an *init* script instead of calling the
>>> release start directly.
>
> e.g.:
>
>     sudo("webapp start")
>
> Then the shell script "webapp" calls start functions for the python app and
> the erlang app (i.e., "/path/to/erlangapp/rel/eappnode/bin/eappnode start").
>
>
>> :~/test_project/rel/mynode/bin$ sudo ./mynode attach
>> ...
>
> I didn't know about attach!  I've just verified I can ssh onto the remote
> machine and attach to the node.
>
> Why is sshing onto the remote machine and attaching better than running an
> erlang shell on your local machine and connecting to the remote machine from
> there?
>
> Thanks
>
> Ivan
>
>
>
> On 06/07/2012 09:17, André Graf wrote:
>>
>> Hi Ivan,
>>
>> Running EUnit works. I am pretty sure the problem is somehow related
>> with the runner script generated by Rebar (which I haven't changed).
>> I tried both sudo and run. I forgot to mention that you must disable
>> fabric pty when starting the node through the runner script otherwise
>> the start call succeeds but no node (and also no logs) are generated.
>>
>> Symptoms are difficult to describe. The resulting shell looks like that:
>> :~/test_project/rel/mynode/bin$ sudo ./mynode attach
>> Attaching to /tmp//home/user/test_project/rel/mynode/erlang.pipe.3 (^D to
>> exit)
>>
>> ^R
>>
>> So I won't get the normal Erlang shell prompt, I can run some Erlang
>> commands though, but I don't have any tab-completion.
>> Ctrl-D will properly exit, Ctrl-G is not giving me the User switch
>> command, Ctrl-C gives the proper Break menu.
>>
>> Funny here, If I don't use sudo for the attach I get a "Node is not
>> running!" although the node was started without using sudo, but this
>> problem also appears if I start the node directly on the server
>> without going through SSH.
>>
>> Cheers,
>> André
>>
>>
>>
>>
>>
>>
>> On 6 July 2012 07:27, Ivan Uemlianin <> wrote:
>>>
>>> Dear André
>>>
>>> This is what we're doing (see my recent email) and the erlang is working
>>> fine. I'll be at the office this afternoon to check properly but here are
>>> a
>>> few differences:
>>>
>>> - our fab script uses sudo() instead of run();
>>> - this function calls an unit script instead of calling the release start
>>> directly.
>>>
>>>> However, attaching a shell to the
>>>> node triggers a strange
>>>> behavior, the shell is available but
>>>> unusable.
>>>
>>>
>>> What are the symptoms?
>>>
>>> Best wishes
>>>
>>> Ivan
>>>
>>>
>>> Sent from my iPhone
>>>
>>> On 5 Jul 2012, at 23:27, André Graf <> wrote:
>>>
>>> Hello,
>>>
>>> I am working on a small library that uses Python Fabric together with
>>> Rebar deploying of Erlang applications. Fabric provides a scriptable
>>> (it's Python) abstraction over SSH.
>>> While I am able to deploy and upgrade new releases through such a
>>> fabric script I struggle with a simple Erlang node startup.
>>>
>>> A fabric call e.g. run("/path/to/my/release/bin/myproject start")
>>> invokes following SSH command
>>> ssh  "/bin/bash -l -c '/path/to/my/release/bin/myproject
>>> start'"
>>>
>>> This starts the node and I can use the remote shell to operate on the
>>> node. However, attaching a shell to the node triggers a strange
>>> behavior, the shell is available but unusable. It seems the startup
>>> through SSH has somehow confused the involved pipes.
>>>
>>> Do you have any hints on that? I am using rebar 2.0.0 R15B
>>> 20120625_185716 git 2.0.0-45-gc41fda6.
>>>
>>> Cheers,
>>> Andre
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>
>
> --
> ============================================================
> Ivan A. Uemlianin PhD
> Llaisdy
> Speech Technology Research and Development
>
>                     
>                      www.llaisdy.com
>                          llaisdy.wordpress.com
>               github.com/llaisdy
>                      www.linkedin.com/in/ivanuemlianin
>
>               "hilaritas excessum habere nequit"
>                  (Spinoza, Ethica, IV, XLII)
> ============================================================
>
>



More information about the erlang-questions mailing list