Running an application from the (unix) command line

Bengt Kleberg <>
Tue Jan 24 11:06:49 CET 2006


On 2006-01-24 10:41, Thomas Johnsson wrote:
> Bengt Kleberg wrote:
>> ...
>> moreover, i think that the faq should also mention that ''init stop'' 
>> will be run in parallell with ''hello hello_world''. this is important 
>> when something longer running than hello_world is started this way :-)
> That appears not to be true: when I run
>     erl -noshell shtest loop -s init stop
> with
> loop() ->
>     io:format("loop...~n",[]),
>     timer:sleep(1000),
>     loop().
> it just keeps writing ....

either i did a mistake when looking into the problem (most likely), when 
i remember it, or this (fix?) has been introduced since 2002 (when i had 
the problem).


> While we are on this subject I'd like to add a few related questions:
> 
> 1. How do I get rid of the "text junk output" written on standard out in 
> the beginning of a run? Like:
> 
> Erlang (BEAM) emulator version 5.4.5 [hipe] [threads:0] [kernel-poll]
> 
> =PROGRESS REPORT==== 24-Jan-2006::09:07:13 ===
>           supervisor: {local,sasl_safe_sup}
>              started: [{pid,<0.32.0>},
>                        {name,alarm_handler},
>                        {mfa,{alarm_handler,start_link,[]}},
>                        {restart_type,permanent},
>                        {shutdown,2000},
>                        {child_type,worker}]
> 
> (I don't get this with the Windows )

try starting like this:
erl -sasl sasl_error_logger false ...


> 2. There appears to be quite a big start-up cost (or maybe it is 
> termination cost),
>  > time erl -noshell -s init stop
> may take about a second. Any suggestions in how to reduce this?

Stand-alone Erlang (http://www.sics.se/~joe/sae.html).

also, somebody made a c-program that can load a module (and execute it) 
into a running erlang system, from the unix command line. that was 
faster than starting erlang.
i never used it, just read about it.


> Any other suggestions on using erlang standalone as smoothly as possible 
> will be greatly appreciated.

i have a script called erl_run that i (hard) link to when i want to run 
a new erlang module standalone.
it says:
#! /bin/sh

module=`basename $1`

erl +A 2 -sasl sasl_error_logger false -noshell -q -pa 
/home/eleberg/private/erlang/ebin -pa 
/home/eleberg/private/erlang/lib/erlang -s $module main $*


the idea is that all my standalone erlang modules are in 
/home/eleberg/private/erlang/ebin and has a main/1 exported. so the 
erlang module ''bepp'' has a /home/eleberg/private/erlang/ebin/bepp.beam 
and a /home/eleberg/bin/bepp shell script. the latter is a link to erl_run.


bengt



More information about the erlang-questions mailing list