File: script.html

package info (click to toggle)
erlang-doc-html 1%3A10.b.1a-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 22,488 kB
  • ctags: 9,933
  • sloc: erlang: 505; ansic: 323; perl: 61; sh: 45; makefile: 39
file content (279 lines) | stat: -rw-r--r-- 6,451 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.2 -->
<HTML>
<HEAD>
  <TITLE>script</TITLE>
  <SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
  <STYLE TYPE="text/css">
<!--
    .REFBODY     { margin-left: 13mm }
    .REFTYPES    { margin-left: 8mm }
-->
  </STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
      ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
  <IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<H1>script</H1>
</CENTER>

<H3>FILE</H3>
<DIV CLASS=REFBODY>
script
</DIV>

<H3>FILE SUMMARY</H3>
<DIV CLASS=REFBODY>
Boot script
</DIV>

<H3>DESCRIPTION</H3>
<DIV CLASS=REFBODY>

<P>The <STRONG>boot script</STRONG> describes how the Erlang runtime system is
started. It contains instructions on which code to load and
which processes and applications to start.


<P>The command <CODE>erl -boot Name</CODE> starts the system with a boot
file called <CODE>Name.boot</CODE>, which is generated from the
<CODE>Name.script</CODE> file, using <CODE>systools:script2boot/1</CODE>.


<P>The <CODE>.script</CODE> file is generated by <CODE>systools</CODE> from a
<CODE>.rel</CODE> file and <CODE>.app</CODE> files.


</DIV>

<H3>FILE SYNTAX</H3>
<DIV CLASS=REFBODY>

<P>The boot script is stored in a file with the extension
<CODE>.script</CODE>


<P>The file has the following syntax:


<PRE>
{script, {Name, Vsn},
 [
  {progress, loading},
  {preLoaded, [Mod1, Mod2, ...]},
  {path, [Dir1,&#34;$ROOT/Dir&#34;,...]}.
  {primLoad, [Mod1, Mod2, ...]},
  ...
  {kernel_load_completed},
  {progress, loaded},
  {kernelProcess, Name, {Mod, Func, Args}},
  ...
  {apply, {Mod, Func, Args}},
  ...
  {progress, started}]}.
</PRE>

<P>
<UL>

<LI>
<CODE>Name = string()</CODE> defines the name of the system.


</LI>


<LI>
<CODE>Vsn = string()</CODE> defines the version of the system.


</LI>


<LI>
<CODE>{progress, Term}</CODE> sets the &#34;progress&#34; of the
        initialization program. The function <CODE>init:get_status()</CODE>
        returns the current value of the progress, which is
        <CODE>{InternalStatus,Term}</CODE>.


</LI>


<LI>
<CODE>{path, [Dir]}</CODE> where <CODE>Dir</CODE> is a string. This
        argument sets the load path of the system to <CODE>[Dir]</CODE>. The
        load path used to load modules is obtained from the initial
        load path, which is given in the script file, together with
        any path flags which were supplied in the command line
        arguments. The command line arguments modify the path as
        follows:

        
<UL>

<LI>
<CODE>-pa Dir1 Dir2 ... DirN</CODE> adds the directories
         <CODE>Dir1, Dir2, ..., DirN</CODE> to the front of the initial
         load path.

         
</LI>


<LI>
<CODE>-pz Dir1 Dir2 ... DirN</CODE> adds the directories
         <CODE>Dir1, Dir2, ..., DirN</CODE> to the end of the initial
         load path.

         
</LI>


<LI>
<CODE>-path Dir1 Dir2 ... DirN</CODE> defines a set of
         directories <CODE>Dir1, Dir2, ..., DirN</CODE> which replaces
         the search path given in the script file. Directory names
         in the path are interpreted as follows:

         
<UL>

<LI>
Directory names starting with <CODE>/</CODE> are assumed
                to be absolute path names.

         
</LI>


<LI>
Directory names not starting with <CODE>/</CODE> are
                assumed to be relative the current working directory.

         
</LI>


<LI>
The special <CODE>$ROOT</CODE> variable can only be used
                in the script, not as a command line argument. The
                given directory is relative the Erlang installation
                directory.

         
</LI>


</UL>


        
</LI>


</UL>



</LI>


<LI>
<CODE>{primLoad, [Mod]}</CODE> loads the modules <CODE>[Mod]</CODE>
        from the directories specified in <CODE>Path</CODE>. The script
        interpreter fetches the appropriate module by calling the
        function <CODE>erl_prim_loader:get_file(Mod)</CODE>. A fatal error
        which terminates the system will occur if the module cannot be
        located.


</LI>


<LI>
<CODE>{kernel_load_completed}</CODE> indicates that all modules
        which <STRONG>must</STRONG> be loaded <STRONG>before</STRONG> any processes
        are started are loaded. In interactive mode, all
        <CODE>{primLoad,[Mod]}</CODE> commands interpreted after this
        command are ignored, and these modules are loaded on demand.
        In embedded mode, <CODE>kernel_load_completed</CODE> is ignored, and
        all modules are loaded during system start.


</LI>


<LI>
<CODE>{kernelProcess, Name, {Mod, Func, Args}}</CODE> starts a
        &#34;kernel process&#34;. The kernel process <CODE>Name</CODE> is started
        by evaluating <CODE>apply(Mod, Func, Args)</CODE> which is expected
        to return <CODE>{ok, Pid}</CODE> or <CODE>ignore</CODE>. The <CODE>init</CODE>
        process monitors the behaviour of <CODE>Pid</CODE> and terminates
        the system if <CODE>Pid</CODE> dies. Kernel processes are key
        components of the runtime system. Users do not normally add
        new kernel processes.


</LI>


<LI>
<CODE>{apply, {Mod, Func, Args}}</CODE>. The init process simply
        evaluates <CODE>apply(Mod, Func, Args)</CODE>. The system
        terminates if this results in an error. The boot procedure
        hangs if this function never returns.


</LI>


</UL>

<P>
<TABLE CELLPADDING=4>
  <TR>
    <TD VALIGN=TOP><IMG ALT="Note!" SRC="note.gif"></TD>
    <TD>

<P>In the <CODE>interactive</CODE> system the code loader provides
        demand driven code loading, but in the <CODE>embedded</CODE> system
        the code loader loads all the code immediately. The same
        version of <CODE>code</CODE> is used in both cases. The code server
        calls <CODE>init:get_argument(mode)</CODE> to find out if it should
        run in demand mode, or non-demand driven mode.

    </TD>
  </TR>
</TABLE>

</DIV>

<H3>SEE ALSO</H3>
<DIV CLASS=REFBODY>

<P>systools(3)


</DIV>

<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
Martin Bjrklund - support@erlang.ericsson.se<BR>
Magnus Frberg - support@erlang.ericsson.se<BR>

</DIV>
<CENTER>
<HR>
<SMALL>sasl 2.0<BR>
Copyright &copy; 1991-2004
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>