Erlang 20参考手册
sasl
script
档案
剧本
文件摘要
引导脚本
描述
大引导脚本描述Erlang运行时系统是如何启动的。它包含关于要加载哪些代码以及要启动哪些进程和应用程序的说明。
命令erl -boot Name
使用一个名为的启动文件启动系统,该文件Name.boot
由Name.script
文件生成systools:script2boot/1
。
大.script
文件由systools
从.rel
文件和文件.app
档案。
文件语法
引导脚本存储在扩展名为.script
该文件具有以下语法:
{script, {Name, Vsn},
[
{progress, loading},
{preLoaded, [Mod1, Mod2, ...]},
{path, [Dir1,"$ROOT/Dir",...]}.
{primLoad, [Mod1, Mod2, ...]},
...
{kernel_load_completed},
{progress, loaded},
{kernelProcess, Name, {Mod, Func, Args}},
...
{apply, {Mod, Func, Args}},
...
{progress, started}]}.
Name = string()
定义系统名称。
Vsn = string()
定义系统版本。
{progress, Term}
设置初始化程序的“进度”。该init:get_status/0
函数返回进度的当前值,即{InternalStatus,Term}
。
{path, [Dir]}
Dir
是一根绳子。此参数将系统的加载路径设置为[Dir]
用于加载模块的加载路径是从脚本文件中给出的初始加载路径以及命令行参数中提供的任何路径标志中获得的。命令行参数修改路径如下:
-
-pa Dir1 Dir2 ... DirN
添加目录DirN, DirN-1, ..., Dir2, Dir1
到初始加载路径的前面。
-
-pz Dir1 Dir2 ... DirN
添加目录Dir1, Dir2, ..., DirN
到初始加载路径的末尾。
-
-path Dir1 Dir2 ... DirN
定义一组目录Dir1, Dir2, ..., DirN
替换脚本文件中给定的搜索路径。路径中的目录名解释如下:
- Directory names starting with `/` are assumed to be absolute path names.
- Directory names not starting with `/` are assumed to be relative the current working directory.
- The special `$ROOT` variable can only be used in the script, not as a command-line argument. The given directory is relative the Erlang installation directory.
{primLoad, [Mod]}
加载模块[Mod]
中指定的目录。Path
脚本解释器通过调用erl_prim_loader:get_file(Mod)
如果无法找到模块,则会发生终止系统的致命错误。
{kernel_load_completed}
指示所有模块必装上以前启动的任何进程都会加载。在交互模式下,所有{primLoad,[Mod]}
在此命令之后解释的命令将被忽略,这些模块将按需加载。在嵌入式模式下,kernel_load_completed
被忽略,并且在系统启动期间加载所有模块。
{kernelProcess, Name, {Mod, Func, Args}}
启动“内核进程”Name
通过评估apply(Mod, Func, Args)
开始函数是返回{ok, Pid}
或ignore
...init
进程监视Pid
并在下列情况下终止系统:Pid
死了。内核进程是运行时系统的关键组件。用户通常不会添加新的内核进程。
{apply, {Mod, Func, Args}}**.**
init进程评估apply(Mod, Func, Args)
如果这导致错误,系统将终止。如果此函数从未返回,则启动过程挂起。
注
在交互式系统中,代码加载器提供需求驱动的代码加载,但在嵌入式系统中,代码加载器会立即加载所有代码。同版本的code
在这两种情况下都使用。代码服务器调用init:get_argument(mode)
以确定它是以需求模式还是非需求驱动模式运行。
另见
systools(3)
sasl相关
Erlang 是一种通用的面向并发的编程语言,可应付大规模开发活动的程序设计语言和运行环境。
主页 | https://www.erlang.org/ |
源码 | https://github.com/erlang/otp |
版本 | 20 |
发布版本 | 20.1 |