<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css"> <title>Erlang -- script</title> </head> <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript"> <!-- function getWinHeight() { var myHeight = 0; if( typeof( window.innerHeight ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function setscrollpos() { var objf=document.getElementById('loadscrollpos'); document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', setscrollpos); //--></script><div id="leftnav"><div class="innertube"> <img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/sasl-2.2.1.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>System Application Support Libraries (SASL)</strong><br><strong>Reference Manual</strong><br><small>Version 2.2.1</small></p> <br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p> <ul class="flipMenu"> <li title="sasl (App)"><a href="sasl_app.html">sasl (App) </a></li> <li id="no" title="alarm_handler " expanded="false">alarm_handler<ul> <li><a href="alarm_handler.html"> Top of manual page </a></li> <li title="clear_alarm-1"><a href="alarm_handler.html#clear_alarm-1">clear_alarm/1</a></li> <li title="get_alarms-0"><a href="alarm_handler.html#get_alarms-0">get_alarms/0</a></li> <li title="set_alarm-1"><a href="alarm_handler.html#set_alarm-1">set_alarm/1</a></li> </ul> </li> <li id="no" title="overload " expanded="false">overload<ul> <li><a href="overload.html"> Top of manual page </a></li> <li title="request-0"><a href="overload.html#request-0">request/0</a></li> <li title="get_overload_info-0"><a href="overload.html#get_overload_info-0">get_overload_info/0</a></li> </ul> </li> <li id="no" title="rb " expanded="false">rb<ul> <li><a href="rb.html"> Top of manual page </a></li> <li title="filter-1"><a href="rb.html#filter-1">filter/1</a></li> <li title="filter-2"><a href="rb.html#filter-2">filter/2</a></li> <li title="grep-1"><a href="rb.html#grep-1">grep/1</a></li> <li title="h-0"><a href="rb.html#h-0">h/0</a></li> <li title="help-0"><a href="rb.html#help-0">help/0</a></li> <li title="list-0"><a href="rb.html#list-0">list/0</a></li> <li title="list-1"><a href="rb.html#list-1">list/1</a></li> <li title="rescan-0"><a href="rb.html#rescan-0">rescan/0</a></li> <li title="rescan-1"><a href="rb.html#rescan-1">rescan/1</a></li> <li title="show-0"><a href="rb.html#show-0">show/0</a></li> <li title="show-1"><a href="rb.html#show-1">show/1</a></li> <li title="start-0"><a href="rb.html#start-0">start/0</a></li> <li title="start-1"><a href="rb.html#start-1">start/1</a></li> <li title="start_log-1"><a href="rb.html#start_log-1">start_log/1</a></li> <li title="stop-0"><a href="rb.html#stop-0">stop/0</a></li> <li title="stop_log-0"><a href="rb.html#stop_log-0">stop_log/0</a></li> </ul> </li> <li id="no" title="release_handler " expanded="false">release_handler<ul> <li><a href="release_handler.html"> Top of manual page </a></li> <li title="check_install_release-1"><a href="release_handler.html#check_install_release-1">check_install_release/1</a></li> <li title="check_install_release-2"><a href="release_handler.html#check_install_release-2">check_install_release/2</a></li> <li title="create_RELEASES-4"><a href="release_handler.html#create_RELEASES-4">create_RELEASES/4</a></li> <li title="install_file-2"><a href="release_handler.html#install_file-2">install_file/2</a></li> <li title="install_release-1"><a href="release_handler.html#install_release-1">install_release/1</a></li> <li title="install_release-2"><a href="release_handler.html#install_release-2">install_release/2</a></li> <li title="make_permanent-1"><a href="release_handler.html#make_permanent-1">make_permanent/1</a></li> <li title="remove_release-1"><a href="release_handler.html#remove_release-1">remove_release/1</a></li> <li title="reboot_old_release-1"><a href="release_handler.html#reboot_old_release-1">reboot_old_release/1</a></li> <li title="set_removed-1"><a href="release_handler.html#set_removed-1">set_removed/1</a></li> <li title="set_unpacked-2"><a href="release_handler.html#set_unpacked-2">set_unpacked/2</a></li> <li title="unpack_release-1"><a href="release_handler.html#unpack_release-1">unpack_release/1</a></li> <li title="which_releases-0"><a href="release_handler.html#which_releases-0">which_releases/0</a></li> <li title="which_releases-1"><a href="release_handler.html#which_releases-1">which_releases/1</a></li> <li title="upgrade_app-2"><a href="release_handler.html#upgrade_app-2">upgrade_app/2</a></li> <li title="downgrade_app-2"><a href="release_handler.html#downgrade_app-2">downgrade_app/2</a></li> <li title="downgrade_app-3"><a href="release_handler.html#downgrade_app-3">downgrade_app/3</a></li> <li title="upgrade_script-2"><a href="release_handler.html#upgrade_script-2">upgrade_script/2</a></li> <li title="downgrade_script-3"><a href="release_handler.html#downgrade_script-3">downgrade_script/3</a></li> <li title="eval_appup_script-4"><a href="release_handler.html#eval_appup_script-4">eval_appup_script/4</a></li> </ul> </li> <li id="no" title="systools " expanded="false">systools<ul> <li><a href="systools.html"> Top of manual page </a></li> <li title="make_relup-3"><a href="systools.html#make_relup-3">make_relup/3</a></li> <li title="make_relup-4"><a href="systools.html#make_relup-4">make_relup/4</a></li> <li title="make_script-1"><a href="systools.html#make_script-1">make_script/1</a></li> <li title="make_script-2"><a href="systools.html#make_script-2">make_script/2</a></li> <li title="make_tar-1"><a href="systools.html#make_tar-1">make_tar/1</a></li> <li title="make_tar-2"><a href="systools.html#make_tar-2">make_tar/2</a></li> <li title="script2boot-1"><a href="systools.html#script2boot-1">script2boot/1</a></li> </ul> </li> <li title="appup"><a href="appup.html">appup</a></li> <li title="rel"><a href="rel.html">rel</a></li> <li title="relup"><a href="relup.html">relup</a></li> <li title="script"><a href="script.html">script</a></li> </ul> </div></div> <div id="content"> <div class="innertube"> <!-- refpage --><center><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> <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> <p>The command <span class="code">erl -boot Name</span> starts the system with a boot file called <span class="code">Name.boot</span>, which is generated from the <span class="code">Name.script</span> file, using <span class="code">systools:script2boot/1</span>. </p> <p>The <span class="code">.script</span> file is generated by <span class="code">systools</span> from a <span class="code">.rel</span> file and <span class="code">.app</span> files. </p> </p></div> <h3><a name="id74387">FILE SYNTAX</a></h3> <div class="REFBODY"> <p>The boot script is stored in a file with the extension <span class="code">.script</span></p> <p>The file has the following syntax: </p> <div class="example"><pre> {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}]}. </pre></div> <ul> <li> <span class="code">Name = string()</span> defines the name of the system. </li> <li> <span class="code">Vsn = string()</span> defines the version of the system. </li> <li> <span class="code">{progress, Term}</span> sets the "progress" of the initialization program. The function <span class="code">init:get_status()</span> returns the current value of the progress, which is <span class="code">{InternalStatus,Term}</span>. </li> <li> <p><span class="code">{path, [Dir]}</span> where <span class="code">Dir</span> is a string. This argument sets the load path of the system to <span class="code">[Dir]</span>. 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:</p> <ul> <li> <span class="code">-pa Dir1 Dir2 ... DirN</span> adds the directories <span class="code">Dir1, Dir2, ..., DirN</span> to the front of the initial load path. </li> <li> <span class="code">-pz Dir1 Dir2 ... DirN</span> adds the directories <span class="code">Dir1, Dir2, ..., DirN</span> to the end of the initial load path. </li> <li> <p><span class="code">-path Dir1 Dir2 ... DirN</span> defines a set of directories <span class="code">Dir1, Dir2, ..., DirN</span> which replaces the search path given in the script file. Directory names in the path are interpreted as follows:</p> <ul> <li>Directory names starting with <span class="code">/</span> are assumed to be absolute path names. </li> <li>Directory names not starting with <span class="code">/</span> are assumed to be relative the current working directory. </li> <li>The special <span class="code">$ROOT</span> 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> <span class="code">{primLoad, [Mod]}</span> loads the modules <span class="code">[Mod]</span> from the directories specified in <span class="code">Path</span>. The script interpreter fetches the appropriate module by calling the function <span class="code">erl_prim_loader:get_file(Mod)</span>. A fatal error which terminates the system will occur if the module cannot be located. </li> <li> <span class="code">{kernel_load_completed}</span> indicates that all modules which <strong>must</strong> be loaded <strong>before</strong> any processes are started are loaded. In interactive mode, all <span class="code">{primLoad,[Mod]}</span> commands interpreted after this command are ignored, and these modules are loaded on demand. In embedded mode, <span class="code">kernel_load_completed</span> is ignored, and all modules are loaded during system start. </li> <li> <span class="code">{kernelProcess, Name, {Mod, Func, Args}}</span> starts a "kernel process". The kernel process <span class="code">Name</span> is started by evaluating <span class="code">apply(Mod, Func, Args)</span> which is expected to return <span class="code">{ok, Pid}</span> or <span class="code">ignore</span>. The <span class="code">init</span> process monitors the behaviour of <span class="code">Pid</span> and terminates the system if <span class="code">Pid</span> dies. Kernel processes are key components of the runtime system. Users do not normally add new kernel processes. </li> <li> <span class="code">{apply, {Mod, Func, Args}}</span>. The init process simply evaluates <span class="code">apply(Mod, Func, Args)</span>. The system terminates if this results in an error. The boot procedure hangs if this function never returns. </li> </ul> <div class="note"> <div class="label">Note</div> <div class="content"><p> <p>In the <span class="code">interactive</span> system the code loader provides demand driven code loading, but in the <span class="code">embedded</span> system the code loader loads all the code immediately. The same version of <span class="code">code</span> is used in both cases. The code server calls <span class="code">init:get_argument(mode)</span> to find out if it should run in demand mode, or non-demand driven mode. </p> </p></div> </div> </div> <h3><a name="id74653">SEE ALSO</a></h3> <div class="REFBODY"> <p>systools(3) </p> </div> </div> <div class="footer"> <hr> <p>Copyright © 1997-2012 Ericsson AB. All Rights Reserved.</p> </div> </div> </div></body> </html>