Go to main content

man pages section 1: User Commands

Exit Print View

Updated: July 2017

erl_call (1)


erl_call - Call/Start a Distributed Erlang Node


Please see following description for synopsis


erl_call(1)                      User Commands                     erl_call(1)

       erl_call - Call/Start a Distributed Erlang Node

       erl_call  makes it possible to start and/or communicate with a distrib-
       uted Erlang node. It is built upon  the  erl_interface  library  as  an
       example  application.  Its  purpose  is  to use an Unix shell script to
       interact with a distributed Erlang node. It performs all  communication
       with  the Erlang rex server, using the standard Erlang RPC facility. It
       does not require any special software to be run at  the  Erlang  target

       The main use is to either start a distributed Erlang node or to make an
       ordinary function call. However, it is also possible to pipe an  Erlang
       module  to  erl_call  and  have  it  compiled, or to pipe a sequence of
       Erlang expressions to be evaluated (similar to the Erlang shell).

       Options, which cause stdin to be read, can be used  with  advantage  as
       scripts  from within (Unix) shell scripts. Another nice use of erl_call
       could be from (http) CGI-bin scripts.

       erl_call <options>

              Each option flag is described below  with  its  name,  type  and

                -a [Mod [Fun [Args]]]]:
                  (optional):  Applies  the specified function and returns the
                  result. Mod must be specified,  however  start  and  []  are
                  assumed  for  unspecified  Fun  and Args, respectively. Args
                  should be in the same format  as  for  erlang:apply/3.  Note
                  that this flag takes exactly one argument, so quoting may be
                  necessary in order to group Mod, Fun and Args, in  a  manner
                  dependent on the behavior of your command shell.

                -c Cookie:
                  (optional):  Use this option to specify a certain cookie. If
                  no cookie is specified, the ~/.erlang.cookie  file  is  read
                  and  its content are used as cookie. The Erlang node we want
                  to communicate with must have the same cookie.

                  (optional): Debug mode. This causes all IO to be  output  to
                  the  file  ~/.erl_call.out.Nodename,  where  Nodename is the
                  node name of the Erlang node in question.

                  (optional): Reads a sequence of  Erlang  expressions,  sepa-
                  rated  by  ','  and  ended  with a '.', from stdin until EOF
                  (Control-D).  Evaluates  the  expressions  and  returns  the
                  result from the last expression. Returns {ok,Result} if suc-

                -h HiddenName:
                  (optional): Specifies the  name  of  the  hidden  node  that
                  erl_call represents.

                  (optional):  Reads  an Erlang module from stdin and compiles

                -n Node:
                  (one of -n, -name, -sname is required): Has the same meaning
                  as  -name  and can still be used for backwards compatibility

                -name Node:
                  (one of -n, -name, -sname is required): Node is the name  of
                  the  node  to be started or communicated with. It is assumed
                  that Node is started with erl -name, which means that  fully
                  qualified  long  node  names  are  used. If the -s option is
                  given, an Erlang node will (if necessary)  be  started  with
                  erl -name.

                  (optional):  Halts  the  Erlang  node  specified with the -n
                  switch. This switch overrides the -s switch.

                  (optional): Generates a random name of the hidden node  that
                  erl_call represents.

                  (optional):  Starts  a distributed Erlang node if necessary.
                  This means that in a sequence of calls, where the  '-s'  and
                  '-n  Node'  are constant, only the first call will start the
                  Erlang node. This makes the rest of the  communication  very
                  fast.  This  flag  is  currently  only available on the Unix

                -sname Node:
                  (one of -n, -name, -sname is required): Node is the name  of
                  the  node  to be started or communicated with. It is assumed
                  that Node is started with erl -sname which means that  short
                  node  names  are used. If -s option is given, an Erlang node
                  will be started (if necessary) with erl -sname.

                  (optional): Prints a lot of  verbose  information.  This  is
                  only useful for the developer and maintainer of erl_call.

                -x ErlScript:
                  (optional):  Specifies  another  name of the Erlang start-up
                  script to be used. If not specified, the standard erl start-
                  up script is used.

       Starts an Erlang node and calls erlang:time/0.

       erl_call -s -a 'erlang time' -n madonna

       Terminates an Erlang node by calling erlang:halt/0.

       erl_call -s -a 'erlang halt' -n madonna

       An apply with several arguments.

       erl_call -s -a 'lists map [{math,sqrt},[1,4,9,16,25]]' -n madonna

       Evaluates  a couple of expressions. The input ends with EOF (Control-D)

       erl_call -s -e -n madonna

       Compiles a module and runs it. Again, the input ends with EOF (Control-
       D) . (In the example shown, the output has been formatted afterwards).

       erl_call -s -m -a lolita -n madonna
       start() ->
               P = processes(),
               F = fun(X) -> {X,process_info(X,registered_name)} end,

       See attributes(5) for descriptions of the following attributes:

       |Availability   | runtime/erlang   |
       |Stability      | Uncommitted      |
       This     software     was    built    from    source    available    at
       https://java.net/projects/solaris-userland.   The  original   community
       source     was     downloaded     from      http://www.erlang.org/down-

       Further information about this software can be found on the open source
       community website at http://www.erlang.org/.

Ericsson AB                  erl_interface 3.7.20                  erl_call(1)