erlang启动参数有3种:emulator flags,
flags
plain arguments。
emulator flags 是以“+”开头的,用来控制模拟器的行为,附送一个非常实用的例子:
1.C:\>erl +V
2. Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 5.8.2
flags 是以“-”开头的, 是erlang运行时系统的参数,可以用init:get_argument/1获得。
plain arguments 普通参数,在第一个flag参数前,或在-- flag之后,-extra后的参数都是普通参数。
1.erl +W w -sname arnie +R 9 -s my_init -extra +bertie
2.(arnie@host)1> init:get_argument(sname).3.{ok,[["arnie"]]}
4.(arnie@host)2> init:get_plain_arguments().
5.["+bertie"]
Flags
-Application Par Val 把应用中的Par参数设置为值Val;
-args_file FileName 从文件FileName读取命令行参数;
-boot File 指定启动使用的boot文件,默认是$ROOT/bin/start.boot,在这个目录下还有start_clean.boot,start_sasl.boot。如果需要sasl的话,就“-boot start_sasl ”; -boot_var Var Dir 代替$ROOT用的;
-code_path_cache 不常用;
-compile Mod1 Mod2 ... 不推荐使用了,应该使用erlc;
-config Config 指定配置文件,这个是很有用的,比如在Programming Erlang里,就用到 erl -boot start_sasl -config elog3,其中文件全名是elog3.config,内容如下:
1.%% rotating log and minimal tty
2.[{sasl,[
3. {sasl_error_logger,false},
4. %?fine the parameters of th