1script(5) Files script(5)
2
3
4
6 script - Boot script
7
9 The boot script describes how the Erlang runtime system is started. It
10 contains instructions on which code to load and which processes and
11 applications to start.
12
13 Command erl -boot Name starts the system with a boot file called
14 Name.boot, which is generated from the Name.script file, using sys‐
15 tools:script2boot/1.
16
17 The .script file is generated by systools from a .rel file and from
18 .app files.
19
21 The boot script is stored in a file with extension .script. The file
22 has the following syntax:
23
24 {script, {Name, Vsn},
25 [
26 {progress, loading},
27 {preLoaded, [Mod1, Mod2, ...]},
28 {path, [Dir1,"$ROOT/Dir",...]}.
29 {primLoad, [Mod1, Mod2, ...]},
30 ...
31 {kernel_load_completed},
32 {progress, loaded},
33 {kernelProcess, Name, {Mod, Func, Args}},
34 ...
35 {apply, {Mod, Func, Args}},
36 ...
37 {progress, started}]}.
38
39 Name = string():
40 Defines the system name.
41
42 Vsn = string():
43 Defines the system version.
44
45 {progress, Term}:
46 Sets the "progress" of the initialization program. The
47 init:get_status/0 function returns the current value of the
48 progress, which is {InternalStatus,Term}.
49
50 {path, [Dir]}:
51 Dir is a string. This argument sets the load path of the system to
52 [Dir]. The load path used to load modules is obtained from the ini‐
53 tial load path, which is given in the script file, together with
54 any path flags that were supplied in the command-line arguments.
55 The command-line arguments modify the path as follows:
56
57 * -pa Dir1 Dir2 ... DirN adds the directories DirN, DirN-1, ...,
58 Dir2, Dir1 to the front of the initial load path.
59
60 * -pz Dir1 Dir2 ... DirN adds the directories Dir1, Dir2, ..., DirN
61 to the end of the initial load path.
62
63 * -path Dir1 Dir2 ... DirN defines a set of directories Dir1, Dir2,
64 ..., DirN, which replace the search path given in the script
65 file. Directory names in the path are interpreted as follows:
66
67 * Directory names starting with / are assumed to be absolute path
68 names.
69
70 * Directory names not starting with / are assumed to be relative
71 the current working directory.
72
73 * The special $ROOT variable can only be used in the script, not
74 as a command-line argument. The given directory is relative the
75 Erlang installation directory.
76
77 {primLoad, [Mod]}:
78 Loads the modules [Mod] from the directories specified in Path. The
79 script interpreter fetches the appropriate module by calling
80 erl_prim_loader:get_file(Mod). A fatal error that terminates the
81 system occurs if the module cannot be located.
82
83 {kernel_load_completed}:
84 Indicates that all modules that must be loaded before any processes
85 are started are loaded. In interactive mode, all {primLoad,[Mod]}
86 commands interpreted after this command are ignored, and these mod‐
87 ules are loaded on demand. In embedded mode, kernel_load_completed
88 is ignored, and all modules are loaded during system start.
89
90 {kernelProcess, Name, {Mod, Func, Args}}:
91 Starts the "kernel process" Name by evaluating apply(Mod, Func,
92 Args). The start function is to return {ok, Pid} or ignore. The
93 init process monitors the behavior of Pid and terminates the system
94 if Pid dies. Kernel processes are key components of the runtime
95 system. Users do not normally add new kernel processes.
96
97 {apply, {Mod, Func, Args}}.:
98 The init process evaluates apply(Mod, Func, Args). The system ter‐
99 minates if this results in an error. The boot procedure hangs if
100 this function never returns.
101
102 Note:
103 In an interactive system, the code loader provides demand-driven code
104 loading, but in an embedded system the code loader loads all code imme‐
105 diately. The same version of code is used in both cases. The code
106 server calls init:get_argument(mode) to determine if it is to run in
107 demand mode or non-demand driven mode.
108
109
111 systools(3)
112
113
114
115Ericsson AB sasl 3.4.1 script(5)