I have a genserver module which I need to start as a server running in the background. During development, I used a standard erl terminal to start it as
$erl
Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.7.2 (abort with ^G)
1> myserver:start_link().
<ok, some_pid>
Everything worked fine and I was able to call the server from other modules.
Now, I need to run it as a server continuously and stumbled upon the erl_call function. So now I do:
erl_call -d -s -a 'myserver start_link' -sname myserver_node
But, the server starts, but shuts down automatically. I enabled the -d flag to see what's going wrong. This is what I see in the debug trace file:
===== Log started ======
Fri Oct 2 04:42:32 2009
erl_call: sh -c exec erl -noinput -sname myserver_node -s erl_reply reply 174.143.175.70 42457 5882
=ERROR REPORT==== 2-Oct-2009::04:44:05 ===
** Generic server myserver terminating
** Last message in was {'EXIT',<0.59.0>,normal}
** When Server state == {20499,24596,28693,32790,36887,40984,45081}
** Reason for termination ==
** {function_clause,[{myserver,terminate,
[normal,
{20499,24596,28693,32790,36887,40984,45081}]},
{gen_server,terminate,6},
{proc_lib,init_p_do_apply,3}]}
Any idea what's causing the server to shut down automatically? The trace even says the reason for termination was normal. But I didn't initiate the termination.