How to force init/1 to start at application start

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to force init/1 to start at application start

Dmitry
Hello

I have an init/1 function which does not start at application startup.




init([Ref, Socket, Transport, Opts]) ->

    MyTable = ets:new(myphone, [set]),

    MyTable2 = ets:new(socket1, [set]),
    lager:start(),

  Timer = erlang:send_after(1210000, self(), check),

    {ok, #state{ref=Ref, socket=Socket, transport=Transport, opts= Opts, dict = MyTable, dict2 = MyTable2, timer = Timer}, 0}.



How to force it to start at an application startup and only once.?





_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: How to force init/1 to start at application start

Robert Virding
Sorry missing something here, and init/1 function in what?


On 7 April 2017 at 14:06, Dmitry <[hidden email]> wrote:
Hello

I have an init/1 function which does not start at application startup.




init([Ref, Socket, Transport, Opts]) ->

    MyTable = ets:new(myphone, [set]),

    MyTable2 = ets:new(socket1, [set]),
    lager:start(),

  Timer = erlang:send_after(1210000, self(), check),

    {ok, #state{ref=Ref, socket=Socket, transport=Transport, opts= Opts, dict = MyTable, dict2 = MyTable2, timer = Timer}, 0}.



How to force it to start at an application startup and only once.?





_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions