erl

COMMAND

COMMAND SUMMARY

DESCRIPTION

The executable script erl is a front-end to the
Erlang runtime system. The flags
for this program are described below.

Windows 95/NT users will probably want to use the werl program
instead, which uses its own window and supports command-line editing
and has scrollbars.
The erl program on Windows provides no line editing in its
shell and on Windows 95, there is no scroll back to see text which has
scrolled off the screen.
The erl program must be used, however, in pipelines or if you want
to redirect standard input or output.

EXPORTS

erl <script-flags> <user-flags>

Starts the Erlang system. The erl script pre-processes some
of the <script-flags> and passes the
flags to the init process in the Erlang system. The
<script-flags> argument is used to initialize the Erlang
kernel processes.

The <user-flags> argument is also passed to the init process
and can be accessed through the init module in the
running system. See init(3).

Script Flags

The following script flags are supported:

-AppName Key Value

Overrides the Key configuration parameter of the
AppName application. See application(3).

-boot File

Specifies the name of the boot script, File.boot,
which is used to start the system. See init(3). Unless
File contains an absolute path, the system searches for File.boot in the current and <ERL_INSTALL_DIR>/bin directories .
If this flag is omitted, the
<ERL_INSTALL_DIR>/bin/start.boot boot script is used.

-boot_var Var Directory [Var Directory]

If the boot script used contains another path variable than
$ROOT, this variable must have a value assigned in order to start
the system. A boot variable is used if user
applications have been installed in another location than underneath the
<ERL_INSTALL_DIR>/lib directory. $Var is expanded
to Directory in the boot script.

-compile mod1 mod2 ....

Makes the Erlang system compile mod1.erl mod2.erl .... and
then terminate (with non-zero exit code if the compilation of some
file didn't succeed). Implies -noinput.

-config Config

Reads the Config.config configuration file in order to
configure the system. See application(3).

-cookie

This flag from release 4.3 is now obsolete. The default of an Erlang
system is to read the $HOME/.erlang.cookie file when started and
to set the node cookie to the contents of the user's cookie file. If no such
file is found, the system will create one and it will be filled with a
random string. See -setcookie.

-env Variable Value

Sets the HOST OS environment variable Variable to the value Value
of the Erlang system. For example:

% erl -env DISPLAY gin:0

In this example, an Erlang system is started with the DISPLAY environment
variable set to the value gin:0.

-heart

Starts heart beat monitoring of the Erlang system. See heart(3).

-hosts Hosts

Specifies the IP addresses for the hosts on which
an Erlang boot servers are running.
This flag is mandatory if the -loader inet
flag is present. On each host, there must be one Erlang node running,
on which the boot_server must be started.
The IP addresses must be given in the standard form (four decimal
numbers separated by periods, for example "150.236.20.74").
Hosts names are not acceptable, but an broadcast address (preferably
limited to the local network) is.

-id Id

Specifies the identity of the Erlang system. If the system
runs as a distributed node, Id must be identical to the name
supplied together with the -sname or -name distribution
flags.

-instr

Selects an instrumented Erlang system (virtual
machine) to run,
instead of the ordinary one. When running an instrumented system,
some resource usage data can be obtained and analysed using the
module instrument. Functionally, it behaves exactly like
an ordinary Erlang system.

-loader Loader

Specifies the name of the loader used to load Erlang modules
into the system. See erl_prim_loader(3).
Loader can be efile (use the
local file system), or inet (load using the
boot_server on another Erlang node). If Loader is
something else, the user supplied Loader port program is
started.
If the -loader flag is omitted efile is assumed.

-make

Makes the Erlang system invoke make:all() in the
current work directory and then terminate. See make(3).
Implies -noinput.

-man Module

Displays the manual page for the Erlang module Module.

-mode Mode

The mode flag indicates if the system will load code
automatically at runtime, or if all code is loaded
during system initialization. Mode can be either
interactive to allow automatic code loading, or
embedded to load all code during start-up. See code(3).

-name Name

Makes the node a distributed node. This flag invokes
all network servers necessary for a node to become
distributed. See net_kernel(3).
The name of the node will be Name@Host, where
Host is the fully qualified host name of the current host.
This option also ensures that epmd runs on
the current host before Erlang is started.
See epmd(1).

-noinput

Ensures that the Erlang system never tries to read any input.
Implies -noshell.

-noshell

Starts an Erlang system with no shell at all. This flag makes it possible to
have the Erlang system as a component in a series of UNIX pipes.

-nostick

Disables the sticky directory facility of the code server.
See code(3).

-oldshell

Invokes the old Erlang shell from Erlang release 3.3. The old
shell can still be used.

-pa Directories

Adds the directories Directories to the head of the search
path of the code server, as if code:add_pathsa/1 was
called. See code(3).

-pz Directories

Adds the directories Directories to the end of the search
path of the code server, as if code:add_pathsa/1 was
called. See code(3).

-s Mod [Fun [Args]]

Passes the -s flag to the init:boot() routine.
See init(3).

-setcookie Cookie

Sets the magic cookie of the current node to Cookie.
As erlang:set_cookie(node(),Cookie) is used, all
other nodes will also be assumed to have their cookies
set to Cookie. In this way, several nodes can
share one magic cookie. Erlang magic cookies are explained
in auth(3).

-sname Name

This is the same as the -name flag, with the exception that
the host name portion of the node name will not be fully qualified.
The following command is used do start Erlang at the host with the name gin.eua.ericsson.se

% erl -sname klacke
Eshell V4.7 (abort with ^G)
(klacke@gin)1>

Only the host name portion of the node name will be relevant. This is
sometimes the only way to run distributed Erlang if the DNS (Domain
Name System) is not running. There can be no communication between
systems running with the -sname flag and those running with
the -name flag, as node names must be unique in distributed
Erlang systems.

-version

Makes the system print out its version number.

-x

Invokes the Erlang Support System xerl.

All these flags are processed during the start-up of the Erlang
kernel servers and before any user processes are started.
All flags are passed to init:boot(Args). See init(3).
All additional flags (<user_flags>) passed to the script will
be passed to init:boot as well, and they can be accessed using
the init module.

System Flags

The erl script invokes the code for the Erlang virtual
machine. This program supports the following flags:

-B

De-activates the break handler for ^C and ^\ .

-h size

Sets the default heap size of processes to the size size.

-l

Displays info while loading code.

-P Number

Sets the total number of processes for this system. The Number must be
greater than 15 and less than 32769.

-s size

Sets the default stack size for Erlang processes to the
size size.

-v

Verbose

-V

Prints the version of Erlang at start-up.

The erl script must be changed to set or change these flags.
They can also be set directly with the special flag +. For example:

% erl -name foo +B +l

In this example, a distributed node is started with the break
handler turned off and a lot of info is displayed while the code
is loading.

Notes

The special flag -- is used to end the system flags.
The following example is typical for starting a system:

jam47 -- -s mod1 -s mod2 ........

It is not recommendable to run the code for the
Erlang virtual machine directly, or set any of the flags for it
with the special + flag. It should be used with care.