This chapter describes how an embedded system is started.
There are four programs involved, and they all normally reside
in the directory
In an embedded system there usually is no interactive shell.
However, it is possible for an operator to attach to the
Erlang runtime system by giving the command
Basically, the procedure is as follows. The program
This program is called when the machine is started. It may
be modified or re-written to suit a special system. By
default, it must be called
The start program must call
This program should set static parameters and environment
variables such as
The
The following script illustrates the default behaviour of the program.
/dev/null 2>&1 &]]>
The following script illustrates a modification where the
node is given the name
/dev/null 2>&1 &]]>
If a diskless and/or read-only client node is about to start the
CLIENTDIR=$ROOTDIR/clients/clientname
START_ERL_DATA=${1:-$CLIENTDIR/bin/start_erl.data}
This program is used to start the emulator, but you will not
be connected to the shell.
Usage: run_erl pipe_dir/ log_dir "exec command [parameters ...]"
Where
In the
erlang.log.1
erlang.log.1, erlang.log.2
erlang.log.1, erlang.log.2, erlang.log.3
erlang.log.1, erlang.log.2, erlang.log.3, erlang.log.4
erlang.log.2, erlang.log.3, erlang.log.4, erlang.log.5
erlang.log.3, erlang.log.4, erlang.log.5, erlang.log.1
...
with the most recent logfile being the right most in each row of the above list. That is, the most recent file is the one with the highest number, or if there are already four files, the one before the skip.
When a logfile is opened (for appending or created) a time stamp is written to the file. If nothing has been written to the log files for 15 minutes, a record is inserted that says that we're still alive.
This program is used to attach to a running Erlang runtime system,
started with
Usage: to_erl [pipe_name | pipe_dir]
Where
To disconnect from the shell without exiting the Erlang
runtime system, type
This program starts the Erlang emulator with parameters
The following script illustrates the behaviour of the program.
#!/bin/sh
#
# This program is called by run_erl. It starts
# the Erlang emulator and sets -boot and -config parameters.
# It should only be used at an embedded target system.
#
# Usage: start_erl RootDir RelDir DataFile [ErlFlags ...]
#
ROOTDIR=$1
shift
RELDIR=$1
shift
DataFile=$1
shift
ERTS_VSN=`awk '{print $1}' $DataFile`
VSN=`awk '{print $2}' $DataFile`
BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
EMU=beam
PROGNAME=`echo $0 | sed 's/.*\\///'`
export EMU
export ROOTDIR
export BINDIR
export PROGNAME
export RELDIR
exec $BINDIR/erlexec -boot $RELDIR/$VSN/start -config $RELDIR/$VSN/sys $*
If a diskless and/or read-only client node with the
Assuming the same
exec $BINDIR/erlexec -boot $CLIENTDIR/bin/start @@@
-config $CLIENTDIR/bin/sys $*