I have the following escript:
#!/usr/bin/env escript
%%! -name [email protected]
main(_) ->
NodeName = test,
Host = '127.0.0.1',
Args = "",
{ok, _Node} = slave:start_link(Host, NodeName, Args),
io:format("Node started successfully!").
When running it on Ubuntu 10.04 I get this:
$ ./start_slave
Node started successfully!
$
I want to install my own Erlang (latest version, debug compiled files for dialyzer etc) since the stock install of Erlang on Ubuntu lacks some features. I put my Erlang binaries inside ~/Applications/bin
. Starting Erlang normally works, and starting slave nodes inside an Erlang shell works as well.
However, now my escript doesn't work. After about 60 seconds it returns an error:
$ ./start_slave
escript: exception error: no match of right hand side value {error,timeout}
Even if I change the first line to the escript to use my erlang version, it still does not work:
#!/home/user/Applications/bin/escript
The slave node is started with a call to erlang:open_port/2
which seems to be using sh
which in turn does not read my .bashrc
file that sets my custom PATH
environment variable. The timeout seems to occur when slave:start_link/3
waits for the slave node to respond, which it never does.
How can I roll my own installation of Erlang and start slave nodes inside escripts on Ubuntu 10.4?
Update: I've tried to add the path to my custom Erlang inside /etc/environment
(where the original PATH
in Ubuntu is set) but this does not change anything...
Update 2: Accepting the only answer given (even though it didn't solve the problem). The Ubuntu and Erlang versions are a bit old now and this might not be an issue anymore.
Is it possible that the slave node is being run with the other Erlang install? Listed under reasons for timeout error in the documentation on slave nodes I saw "the Erlang nodes have different cookies" which might, I believe, occur in that case.
If this were the case, running ps -FC erlang
while it's waiting for the timeout should show you processes with different paths.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With