1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
<TITLE>erl_call</TITLE>
<SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
<STYLE TYPE="text/css">
<!--
.REFBODY { margin-left: 13mm }
.REFTYPES { margin-left: 8mm }
-->
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
<IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<H1>erl_call</H1>
</CENTER>
<H3>COMMAND</H3>
<DIV CLASS=REFBODY>
erl_call
</DIV>
<H3>COMMAND SUMMARY</H3>
<DIV CLASS=REFBODY>
Call/Start a Distributed Erlang Node
</DIV>
<H3>DESCRIPTION</H3>
<DIV CLASS=REFBODY>
<P><CODE>erl_call</CODE> makes it possible to start and/or communicate with
a distributed Erlang node. It is built upon the <CODE>erl_interface</CODE>
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 <STRONG>rex server</STRONG>, using the standard Erlang RPC facility. It does not require any special
software to be run at the Erlang target node.
<P>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 <CODE>erl_call</CODE> and have it
compiled, or to pipe a sequence of Erlang expressions to be evaluated
(similar to the Erlang shell).
<P>Options, which cause <CODE>stdin</CODE> to be read, can be used with
advantage
as scripts from within (Unix) shell scripts. Another
nice use of <CODE>erl_call</CODE> could be from (http) CGI-bin scripts.
</DIV>
<H3>EXPORTS</H3>
<P><A NAME="erl_call"><STRONG><CODE>erl_call <options></CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P>Each option flag is described below with its name, type and
meaning.
<P>
<DL>
<DT>
-a [Mod [Fun [Args]]]]
</DT>
<DD>
(<STRONG>optional</STRONG>): Applies the specified function
and returns the result. <CODE>Mod</CODE> must be specified, however
<STRONG>[]</STRONG> is assumed for unspecified <CODE>Fun</CODE> and <CODE>Args</CODE>. <CODE>Args</CODE> should
be in the same format as for <CODE>erlang:apply/3</CODE>. Note
that this flag takes exactly one argument, so quoting
may be necessary in order to group <CODE>Mod</CODE>, <CODE>Fun</CODE>
and <CODE>Args</CODE>, in a manner dependent on the behavior
of your command shell.
<BR>
<BR>
</DD>
<DT>
-c Cookie
</DT>
<DD>
(<STRONG>optional</STRONG>): Use this option to specify a certain cookie. If no cookie is specified, the <CODE>~/.erlang.cookie</CODE> file is read and its content are used as cookie. The Erlang node we want to communicate with must have the same cookie.
<BR>
</DD>
<DT>
-d
</DT>
<DD>
(<STRONG>optional</STRONG>): Debug mode. This causes all IO to be output
to the file <CODE>~/.erl_call.out.Nodename</CODE>, where <CODE>Nodename</CODE>
is the node name of the Erlang node in question.
<BR>
<BR>
</DD>
<DT>
-e
</DT>
<DD>
(<STRONG>optional</STRONG>): Reads a sequence of Erlang expressions, separated
by '<STRONG>,</STRONG>' and ended with a '<STRONG>.</STRONG>', from <CODE>stdin</CODE> until
EOF (Control-D). Evaluates the expressions and returns the result from
the last expression. Returns <CODE>{ok,Result}</CODE> if successful.
<BR>
<BR>
</DD>
<DT>
-h HiddenName
</DT>
<DD>
(<STRONG>optional</STRONG>): Specifies the name of the hidden node
that <CODE>erl_call</CODE> represents.
<BR>
<BR>
</DD>
<DT>
-m
</DT>
<DD>
(<STRONG>optional</STRONG>): Reads an Erlang module from <CODE>stdin</CODE> and
compiles it.
<BR>
<BR>
</DD>
<DT>
-n Node
</DT>
<DD>
(one of <CODE>-n, -name, -sname</CODE> is required):
Has the same meaning as <CODE>-name</CODE> and can still be used for
backwards compatibility reasons.
<BR>
<BR>
</DD>
<DT>
-name Node
</DT>
<DD>
(one of <CODE>-n, -name, -sname</CODE> is required): <CODE>Node</CODE> is the name of the node to be
started or communicated with. It is assumed that
<CODE>Node</CODE> is started with <CODE>erl -name</CODE>, which means that fully
qualified long node names are used.
If the <CODE>-s</CODE> option is given, an Erlang node will (if necessary)
be started with <CODE>erl -name</CODE>.
<BR>
<BR>
</DD>
<DT>
-q
</DT>
<DD>
(<STRONG>optional</STRONG>): Halts the Erlang node specified
with the -n switch. This switch overrides the -s switch.
<BR>
<BR>
</DD>
<DT>
-r
</DT>
<DD>
(<STRONG>optional</STRONG>): Generates a random name of the hidden node
that <CODE>erl_call</CODE> represents.
<BR>
<BR>
</DD>
<DT>
-s
</DT>
<DD>
(<STRONG>optional</STRONG>): Starts a distributed Erlang node if necessary.
This means that in a sequence of calls, where the '<CODE>-s</CODE>'
and '<CODE>-n Node</CODE>' 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 platform.
<BR>
<BR>
</DD>
<DT>
-sname Node
</DT>
<DD>
(one of <CODE>-n, -name, -sname</CODE> is required): <CODE>Node</CODE> is the name of the node to
be started or communicated with. It is assumed that <CODE>Node</CODE> is started with <CODE>erl -sname</CODE> which means that short node names are used.
If <CODE>-s</CODE> option is given, an Erlang node will be started (if necessary) with <CODE>erl -sname</CODE>.
<BR>
<BR>
</DD>
<DT>
-v
</DT>
<DD>
(<STRONG>optional</STRONG>): Prints a lot of <CODE>verbose</CODE> information.
This is only useful for the developer and maintainer of <CODE>erl_call</CODE>.
<BR>
<BR>
</DD>
<DT>
-x ErlScript
</DT>
<DD>
(<STRONG>optional</STRONG>): Specifies another name of the Erlang start-up script
to be used. If not specified, the standard <CODE>erl</CODE> start-up script
is used.
<BR>
</DD>
</DL>
</DIV>
<H3>Examples</H3>
<DIV CLASS=REFBODY>
<P>Starts an Erlang node and calls <CODE>erlang:time/0</CODE>.
<PRE>
erl_call -s -a 'erlang time' -n madonna
{18,27,34}
</PRE>
<P>Terminates an Erlang node by calling <CODE>erlang:halt/0</CODE>.
<PRE>
erl_call -s -a 'erlang halt' -n madonna
</PRE>
<P>An apply with several arguments.
<PRE>
erl_call -s -a 'lists map [{math,sqrt},[1,4,9,16,25]]' -n madonna
</PRE>
<P>Evaluates a couple of expressions. The input ends with EOF (Control-D).
<PRE>
erl_call -s -e -n madonna
statistics(runtime),
X=1,
Y=2,
{_,T}=statistics(runtime),
{X+Y,T}.
^D
{ok,{3,0}}
</PRE>
<P>Compiles a module and runs it. Again, the input ends with EOF (Control-D). (In the example shown, the output has been formatted afterwards).
<PRE>
erl_call -s -m -a lolita -n madonna
-module(lolita).
-compile(export_all).
start() ->
P = processes(),
F = fun(X) -> {X,process_info(X,registered_name)} end,
lists:map(F,[],P).
^D
[{<madonna@chivas.du.etx.ericsson.se,0,0>,
{registered_name,init}},
{<madonna@chivas.du.etx.ericsson.se,2,0>,
{registered_name,erl_prim_loader}},
{<madonna@chivas.du.etx.ericsson.se,4,0>,
{registered_name,error_logger}},
{<madonna@chivas.du.etx.ericsson.se,5,0>,
{registered_name,application_controller}},
{<madonna@chivas.du.etx.ericsson.se,6,0>,
{registered_name,kernel}},
{<madonna@chivas.du.etx.ericsson.se,7,0>,
[]},
{<madonna@chivas.du.etx.ericsson.se,8,0>,
{registered_name,kernel_sup}},
{<madonna@chivas.du.etx.ericsson.se,9,0>,
{registered_name,net_sup}},
{<madonna@chivas.du.etx.ericsson.se,10,0>,
{registered_name,net_kernel}},
{<madonna@chivas.du.etx.ericsson.se,11,0>,
[]},
{<madonna@chivas.du.etx.ericsson.se,12,0>,
{registered_name,global_name_server}},
{<madonna@chivas.du.etx.ericsson.se,13,0>,
{registered_name,auth}},
{<madonna@chivas.du.etx.ericsson.se,14,0>,
{registered_name,rex}},
{<madonna@chivas.du.etx.ericsson.se,15,0>,
[]},
{<madonna@chivas.du.etx.ericsson.se,16,0>,
{registered_name,file_server}},
{<madonna@chivas.du.etx.ericsson.se,17,0>,
{registered_name,code_server}},
{<madonna@chivas.du.etx.ericsson.se,20,0>,
{registered_name,user}},
{<madonna@chivas.du.etx.ericsson.se,38,0>,
[]}]
</PRE>
</DIV>
<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
T.Trnkvist - support@erlang.ericsson.se<BR>
</DIV>
<CENTER>
<HR>
<SMALL>erl_interface 3.5.5.2<BR>
Copyright © 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>
|