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

info <>
Thu Jul 23 15:35:01 CEST 2009


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 < > 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