set inetrc on a remote beam ?

Nicolas Niclausse nicolas@REDACTED
Mon Sep 12 19:10:56 CEST 2005


Hello,

I'm trying to set an inetrc file with a remote beam started with the 
'slave' module. Problem: it works when the remote beam is on the same 
host, but not on a remote host.

My system: Linux RHAS3, Erlang (BEAM) emulator version 5.4.9 [64-bit] 
[source] [hipe] [threads:0]

nef:>./test.sh nef 
 

Args: " -rsh ssh -setcookie bar "
Result: {ok,foo@REDACTED}
Args: " -rsh ssh -setcookie bar -kernel inetrc 
'\"/home/nniclaus/sources/erlang/tsunami/priv/inetrc\"'"
Result: {ok,foo@REDACTED}

nef:>./test.sh nef001 
 

Args: " -rsh ssh -setcookie bar "
Result: {ok,foo@REDACTED}
Args: " -rsh ssh -setcookie bar -kernel inetrc 
'\"/home/nniclaus/sources/erlang/tsunami/priv/inetrc\"'"
Result: {error,timeout}

but the file exist on the remote host:
nef:>ssh nef001 "cat /home/nniclaus/sources/erlang/tsunami/priv/inetrc" 
 

{file, resolv, "/etc/resolv.conf"}.
{lookup, [dns]}.

 From the generated crash dump:

...
'no -shutdown_time flag'
'/home/nniclaus/sources/erlang/tsunami/priv/inetrc'
'\'/\''
'syntax error before: '
'application_controller: ~s: ~s~n'
lowercase
...

Any idea ? Or is there another way to set inet configuration ?

------------ testcase.erl:
-module(testcase).
-export([main/1, erl_system_args/0]).

main([Host])-> main(Host);
main(Host)->
     Args= erl_system_args(),
     io:format("Args: ~p~n",[Args]),
     R = slave:start_link(Host,foo,Args ),
     io:format("Result: ~p~n",[R]).

erl_system_args()->
	Rsh = case  init:get_argument(rsh) of
               {ok,[["ssh"]]}  -> " -rsh ssh ";
               _ -> " "
           end,
     Cookies = "-setcookie " ++atom_to_list(erlang:get_cookie()),
     Inet = case init:get_argument(kernel) of
                {ok,[["inetrc",InetRcFile]]} ->
                  " -kernel inetrc '"++ InetRcFile ++"'";
                _ -> " "
            end,
     lists:append([Rsh,Cookies,Inet]).

----------- test.sh:

#!/bin/bash
INPUTRC='"/home/nniclaus/sources/erlang/tsunami/priv/inetrc"'
erl -noshell -rsh ssh -s testcase main $1 -s init stop -sname bar \
  -setcookie bar
erl -noshell -rsh ssh -s testcase main $1 -s init stop -sname bar \
  -setcookie bar -kernel inetrc $INPUTRC

-- 
Nicolas



More information about the erlang-questions mailing list