script(4)
β¨ NAME β¨
script β the Boot script, bestie π
π DESCRIPTION π
okay so listen. the boot script is literally the blueprint for how the Erlang runtime system wakes up and gets dressed in the morning. πΈ it's got instructions in it for which code to load, and which processes and applications to start. it's giving "getting ready for the day" energy, but for a whole runtime system.
the command erl -boot Name starts the system with a boot file called Name.boot, and that file is generated from the Name.script file using systools:script2boot/1. β¨
and where does the .script file come from, you ask? it's generated by systools from a .rel file and from .app files. the whole pipeline is a whole vibe. π
π File Syntax π
the boot script lives in a file with extension .script, and it has this exact syntax:
{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()β defines the system name. that's the name, bestie. π«ΆVsn = string()β defines the system version.{progress, Term}β sets the "progress" of the initialization program. theinit:get_status/0function returns the current value of the progress, which is{InternalStatus,Term}. so it's how you peek at where the boot is at. β{path, [Dir]}βDiris a string. this argument sets the load path of the system to[Dir]. 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 that were supplied in the command-line arguments. and the command-line arguments modify the path like this:-pa Dir1 Dir2 ... DirNadds the directoriesDirN,DirN-1, ...,Dir2,Dir1to the front of the initial load path. π-pz Dir1 Dir2 ... DirNadds the directoriesDir1,Dir2, ...,DirNto the end of the initial load path.-path Dir1 Dir2 ... DirNdefines a set of directoriesDir1,Dir2, ...,DirN, which replace the search path given in the script file. and directory names in the path are interpreted like this:- 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
$ROOTvariable can only be used in the script, not as a command-line argument. the given directory is relative the Erlang installation directory.
- directory names starting with
{primLoad, [Mod]}β loads the modules[Mod]from the directories specified inPath. the script interpreter fetches the appropriate module by callingerl_prim_loader:get_file(Mod). and a fatal error that terminates the system occurs if the module cannot be located. π no cap, that one's serious.{kernel_load_completed}β indicates that all modules that must be loaded before any processes are started are loaded. in interactive mode, all{primLoad,[Mod]}commands interpreted after this command are ignored, and these modules are loaded on demand. in embedded mode,kernel_load_completedis ignored, and all modules are loaded during system start. two modes, two completely different behaviors, iconic. π{kernelProcess, Name, {Mod, Func, Args}}β starts the "kernel process"Nameby evaluatingapply(Mod, Func, Args). the start function is to return{ok, Pid}orignore. the init process monitors the behavior ofPidand terminates the system ifPiddies. kernel processes are key components of the runtime system. and heads up: users do not normally add new kernel processes. like, that's not your lane bestie. π«{apply, {Mod, Func, Args}}.β the init process evaluatesapply(Mod, Func, Args). the system terminates if this results in an error. and the boot procedure hangs if this function never returns. π
NOTE: in an interactive system, the code loader provides demand-driven code loading, but in an embedded system the code loader loads all code immediately. the same version of code is used in both cases. the code server calls init:get_argument(mode) to determine if it is to run in demand mode or non-demand driven mode.
π¦ See Also π¦
systools
and that's the whole page, bestie! this one came from Ericsson AB, it's sasl version 4.4, and it's the script(4) page. periodt. πβ¨π
π¦ where this page comes from
- arch rolling: erlang-core 29.1.1-1 Β· Apache-2.0
- nixos 26.05: erlang 29.1.2
- nixpkgs unstable: erlang 29.1.2
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms