[erlang-questions] How to start an erlang applications from the command line non-interactively?

Jarrod Roberson jarrod@REDACTED
Mon May 5 22:05:01 CEST 2008


On Mon, May 5, 2008 at 2:42 PM, Nick Gerakines <nick@REDACTED> wrote:

> There are a few ways to do what you want. Both of them involve using
> the -detached erl arg.
>
> If you are using an application you'll want to create a boot script
> using the .app and .rel file. I consider this crucial for deploying
> applications.
>
> erl -name myapp@`hostname` -noshell -detached -setcookie myappcookie -boot
> myapp
>
> If you've got a simple MFA that you want to run in the background you
> can do it with -s.
>
> Consider the module foo that exports the method bar:
>
> erl -name fooapp@`hostname` -noshell -detached +W w +A 1 +Ktrue
> -setcookie foocookie -s foo bar
>
> Just keep in mind that to connect to detached erlang nodes, you'll
> need to be sure your cookies match. Otherwise you should be good to
> go.
>
> I tend to do something like:
>
> $ erl -name fooapp_ctl@`hostname` -setcookie foocookie
>
> Eshell V5.6.1  (abort with ^G)
> (fooapp_ctl@REDACTED)1> ^G
> User switch command
>  --> r'fooapp@REDACTED'
>  --> c
> Eshell V5.6.1  (abort with ^G)
> (fooapp@REDACTED)1>
>
> # Nick Gerakines


thanks for the response, I got it working with -noshell, I am looking for
more info on the .app option.
Can someone give me an example on passing arguments using the -s option?
The docs are as clear on the actual syntax.

I have a function start(Port, Htdocs) that I want to call with 8888,
"C:/htdocs" and I can't figure out what the appropriate syntax should be.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080505/6b119d03/attachment.htm>


More information about the erlang-questions mailing list