<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1607" name=GENERATOR></HEAD>
<BODY>
<DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=125160620-12042008>Hi Ralph,</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=125160620-12042008></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN class=125160620-12042008>I 
know its too late to reply :), but I noticed that no one answered 
this.</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=125160620-12042008>Just want to inform you that I do the same thing 
you wish to do using escript and shell script.</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=125160620-12042008></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=125160620-12042008>First make sure you start the nodes with the same 
<EM>cookie</EM> </SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN class=125160620-12042008>$ 
erl -sname mynode -setcookie mycookie ...</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=125160620-12042008></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN class=125160620-12042008>The 
escript should look like:</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=125160620-12042008></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana><FONT color=#0000ff><FONT size=2><SPAN 
class=125160620-12042008>    </SPAN>#!/usr/bin/env 
escript<BR><SPAN class=125160620-12042008>    </SPAN>%% -*- 
erlang -*-</FONT></FONT></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Verdana><FONT color=#0000ff><FONT size=2><SPAN 
class=125160620-12042008>    </SPAN>main(_Args) 
-><BR>    <SPAN 
class=125160620-12042008>    </SPAN>net_kernel:start([shell, 
shortnames]),<BR>    <SPAN 
class=125160620-12042008>    
</SPAN>erlang:set_cookie(node(), <SPAN 
class=125160620-12042008>mycookie</SPAN>),<BR>    <SPAN 
class=125160620-12042008>    
</SPAN>rpc:call(</FONT></FONT></FONT><A href="mailto:'mynode@hostname'"><FONT 
face=Verdana size=2>'<SPAN class=125160620-12042008>my</SPAN><SPAN 
class=125160620-12042008>node</SPAN>@<SPAN 
class=125160620-12042008>hostname</SPAN>'</FONT></A><FONT face=Verdana 
color=#0000ff size=2>, conf_server, reload, []).</FONT></DIV><!-- Converted from text/rtf format -->
<P><SPAN lang=en-us><SPAN class=125160620-12042008><FONT face=Arial 
color=#0000ff size=2>I have tried this script with sasl in my .erlang as you do 
and got the same result "<FONT face="Times New Roman" color=#000000 
size=3>started_at: nonode@nohost</FONT>", seems that the erlang shell is started 
before the escript is executed.</FONT></SPAN></SPAN></P>
<P><SPAN lang=en-us><SPAN class=125160620-12042008></SPAN></SPAN><SPAN 
lang=en-us><SPAN class=125160620-12042008><FONT face=Arial color=#0000ff 
size=2>Another way is to do it in shell script where we needn't hard code the 
hostname as above, and the sasl will show "<FONT face="Times New Roman" 
color=#000000 size=3>started_at: shell<A 
href="mailto:shell@hostname">@hostname</A></FONT>"</FONT></SPAN></SPAN></P>
<P><SPAN lang=en-us><SPAN class=125160620-12042008></SPAN></SPAN><SPAN 
lang=en-us><SPAN class=125160620-12042008><FONT face=Verdana color=#0000ff 
size=2>    #! /bin/sh -fup</FONT></SPAN></SPAN></P>
<P><SPAN lang=en-us><SPAN class=125160620-12042008><FONT face=Verdana 
color=#0000ff size=2>    
NODENAME=\'mynode@$HOSTNAME\'<BR>    erl -sname shell -setcookie 
mycookie > /dev/null << 
!<BR>        rpc:call($NODENAME, 
conf_server, reload, []).<BR>        
halt().<BR>    !<BR></FONT></SPAN></SPAN><SPAN lang=en-us><SPAN 
class=125160620-12042008><FONT face=Verdana color=#0000ff 
size=2></FONT></SPAN></SPAN></P>
<P><SPAN lang=en-us><SPAN class=125160620-12042008><FONT face=Verdana 
color=#0000ff size=2>OR</FONT></SPAN></SPAN></P>
<P><SPAN lang=en-us><SPAN class=125160620-12042008><FONT face=Verdana 
color=#0000ff size=2>    #! /bin/sh -fup</FONT></SPAN></SPAN></P>
<P><SPAN lang=en-us><SPAN class=125160620-12042008><FONT face=Verdana 
color=#0000ff size=2>    
NODENAME=\'mynode@$HOSTNAME\'<BR>    
CMD=rpc:call\($NODENAME,conf_server,reload,[]\).<BR>    erl 
-sname shell -setcookie mycookie -eval $CMD -s init 
stop</P></FONT></SPAN></SPAN>
<P><SPAN lang=en-us><SPAN class=125160620-12042008><FONT face=Verdana 
color=#0000ff size=2> </P></FONT></SPAN></SPAN>
<P><SPAN lang=en-us><FONT face=Arial color=#0000ff 
size=2>Regards,</FONT><B><I></I></B><B><I></I></B></SPAN> <BR><SPAN 
lang=en-us><B><I><FONT face=Verdana color=#000080 size=2>Ali 
Yakout</FONT></I></B></SPAN> </P></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> erlang-questions-bounces@erlang.org 
[mailto:erlang-questions-bounces@erlang.org] <B>On Behalf Of 
</B>db<BR><B>Sent:</B> Friday, February 29, 2008 1:37 AM<BR><B>To:</B> 
erlang-questions@erlang.org<BR><B>Subject:</B> [erlang-questions] set node name 
and escript rpc_call to anothernode<BR></FONT><BR></DIV>
<DIV></DIV>Would I be able to make rpc_call to another node from escript?  
When I start escript, erl node which escript start, is called 
nonode@nohost.  Is there a way for this node to join the pool, so I can 
perform rpc call?<BR><BR>I have tried set the following in my escript:<BR 
clear=all>net_kernel:start([foobar, shortnames])<BR><BR>When I ran the 
escript,  sasl is automatically started up.  This is my default setup 
in .erlang file.  Even though, with net_kernel:start([foobar, shortnames]) 
in escript, sasl application is running on nonode@nohost, but the node never 
assigned the name "foobar".  Why is this?<BR><BR>Here is the sasl 
output:<BR><BR>=PROGRESS REPORT==== 28-Feb-2008::15:44:03 
===<BR>          supervisor: 
{local,sasl_sup}<BR>             
started: 
[{pid,<0.32.0>},<BR>                       
{name,sasl_safe_sup},<BR>                       
{mfa,<BR>                           
{supervisor,start_link,<BR>                               
[{local,sasl_safe_sup},sasl,safe]}},<BR>                       
{restart_type,permanent},<BR>                       
{shutdown,infinity},<BR>                       
{child_type,supervisor}]<BR><BR>=PROGRESS REPORT==== 28-Feb-2008::15:44:03 
===<BR>          supervisor: 
{local,sasl_sup}<BR>             
started: 
[{pid,<0.35.0>},<BR>                       
{name,release_handler},<BR>                       
{mfa,{release_handler,start_link,[]}},<BR>                       
{restart_type,permanent},<BR>                       
{shutdown,2000},<BR>                       
{child_type,worker}]<BR><BR>=PROGRESS REPORT==== 28-Feb-2008::15:44:03 
===<BR>         application: 
sasl<BR>          started_at: 
nonode@nohost<BR><BR>=PROGRESS REPORT==== 28-Feb-2008::15:44:03 
===<BR>          supervisor: 
{local,net_sup}<BR>             
started: 
[{pid,<0.39.0>},<BR>                       
{name,erl_epmd},<BR>                       
{mfa,{erl_epmd,start_link,[]}},<BR>                       
{restart_type,permanent},<BR>                       
{shutdown,2000},<BR>                       
{child_type,worker}]<BR><BR>=PROGRESS REPORT==== 28-Feb-2008::15:44:03 
===<BR>          supervisor: 
{local,net_sup}<BR>             
started: 
[{pid,<0.40.0>},<BR>                       
{name,auth},<BR>                       
{mfa,{auth,start_link,[]}},<BR>                       
{restart_type,permanent},<BR>                       
{shutdown,2000},<BR>                       
{child_type,worker}]<BR><BR>=PROGRESS REPORT==== 28-Feb-2008::15:44:03 
===<BR>          supervisor: 
{local,net_sup}<BR>             
started: 
[{pid,<0.41.0>},<BR>                       
{name,net_kernel},<BR>                       
{mfa,{net_kernel,start_link,[[foobar,shortnames]]}},<BR>                       
{restart_type,permanent},<BR>                       
{shutdown,2000},<BR>                       
{child_type,worker}]<BR><BR>=PROGRESS REPORT==== 28-Feb-2008::15:44:03 
===<BR>          supervisor: 
{local,kernel_sup}<BR>             
started: 
[{pid,<0.38.0>},<BR>                       
{name,net_sup_dynamic},<BR>                       
{mfa,<BR>                           
{erl_distribution,start_link,<BR>                               
[[foobar,shortnames]]}},<BR>                       
{restart_type,permanent},<BR>                       
{shutdown,1000},<BR>                       
{child_type,supervisor}]<BR><BR>-- <BR>rk<BR><BR>That which we persist in doing 
becomes easier for us to do; not that the nature of the thing itself is changed, 
but that our power to do is increased.<BR>-Ralph Waldo Emerson </BODY></HTML>