[erlang-questions] run an otp/application as a service

Bengt Kleberg bengt.kleberg@REDACTED
Thu Jul 23 15:48:42 CEST 2009


Greetings,

Give then module definition below for starting you do the following with
erl:

erl -s starting

I do not know how erlsrv.exe works, but if the rest of the command line
is correct, the whole thing should then be:

erlsrv.exe add ServiceName -args -s starting


bengt

On Thu, 2009-07-23 at 15:35 +0200, info wrote:
> I don't understand what you mean ...
> I added one module starting.erl
> 
> -module(starting).
> -export([start/0].
> start()->application:start(my_application).
> 
> erlsrv.exe add ServiceName -args -s starting(my_application)
> 
> 
> 
> Hi John,
> 
> On Thu, Jul 23, 2009 at 11:34, info <info@REDACTED > wrote:
> >
> > I tried erlsrv.exe add ServiceName -args -s application:start(my_application)
> > as I do it with Eclipse from the console.
> 
> From the docs:
> 
> -s Mod [Func [Arg1, Arg2, ...]](init flag)
>     Makes init call the specified function. Func defaults to start. If
> no arguments are provided, the function is assumed to be of arity 0.
> Otherwise it is assumed to be of arity 1, taking the list
> [Arg1,Arg2,...] as argument.
> 
> so even if you call it like it's supposed to be
>    -s application start my_application
> what will be called is application:start([my_application]) which won't
> work (notice the argument is a list).
> 
> You should add your own startup function and let that start
> applications and whatever else you need.
> 
> regards,
> Vlad



More information about the erlang-questions mailing list