Skip to content

Commit

Permalink
修改install_upgrade.escript
Browse files Browse the repository at this point in the history
  • Loading branch information
terrencehan committed Dec 16, 2014
1 parent 82dc678 commit 1a3eb16
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions rel/files/install_upgrade.escript
Expand Up @@ -31,9 +31,9 @@ main(_) ->

start_distribution(NodeName, Cookie) ->
MyNode = make_script_node(NodeName),
{ok, _Pid} = net_kernel:start([MyNode, shortnames]),
{ok, _Pid} = net_kernel:start([MyNode, longnames]),
erlang:set_cookie(node(), list_to_atom(Cookie)),
TargetNode = make_target_node(NodeName),
TargetNode = list_to_atom(NodeName),
case {net_kernel:hidden_connect_node(TargetNode),
net_adm:ping(TargetNode)} of
{true, pong} ->
Expand All @@ -44,9 +44,6 @@ start_distribution(NodeName, Cookie) ->
end,
TargetNode.

make_target_node(Node) ->
[_, Host] = string:tokens(atom_to_list(node()), "@"),
list_to_atom(lists:concat([Node, "@", Host])).

make_script_node(Node) ->
list_to_atom(lists:concat([Node, "_upgrader_", os:getpid()])).
[_, Host] = string:tokens(Node, "@"),
list_to_atom(lists:concat(["upgrader_", os:getpid(), "@", Host])).

0 comments on commit 1a3eb16

Please sign in to comment.