Merge pull request #1137 from emqtt/develop
Improve the 'listeners restart/stop' CLI
This commit is contained in:
commit
c5b817c634
|
@ -482,11 +482,9 @@ listeners(["restart", Proto, ListenOn]) ->
|
||||||
end,
|
end,
|
||||||
case emqttd_app:restart_listener({list_to_atom(Proto), ListenOn1, []}) of
|
case emqttd_app:restart_listener({list_to_atom(Proto), ListenOn1, []}) of
|
||||||
{ok, _Pid} ->
|
{ok, _Pid} ->
|
||||||
io:format("Restart ~s listen on ~s successfully.~n",
|
io:format("Restart ~s listen on ~s successfully.~n", [Proto, ListenOn]);
|
||||||
[list_to_atom(Proto), list_to_atom(ListenOn)]);
|
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
io:format("Failed to restart ~s listen on ~s, error:~p~n",
|
io:format("Failed to restart ~s listen on ~s, error:~p~n", [Proto, ListenOn, Error])
|
||||||
[list_to_atom(Proto), list_to_atom(ListenOn) ,Error])
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
listeners(["stop", Proto, ListenOn]) ->
|
listeners(["stop", Proto, ListenOn]) ->
|
||||||
|
@ -496,17 +494,15 @@ listeners(["stop", Proto, ListenOn]) ->
|
||||||
end,
|
end,
|
||||||
case emqttd_app:stop_listener({list_to_atom(Proto), ListenOn1, []}) of
|
case emqttd_app:stop_listener({list_to_atom(Proto), ListenOn1, []}) of
|
||||||
ok ->
|
ok ->
|
||||||
io:format("Stop ~s on ~s successfully.~n",
|
io:format("Stop ~s on ~s successfully.~n", [Proto, ListenOn]);
|
||||||
[list_to_atom(Proto), list_to_atom(ListenOn)]);
|
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
io:format("Failed to stop ~s on ~s, error:~p~n",
|
io:format("Failed to stop ~s on ~s, error:~p~n", [Proto, ListenOn, Error])
|
||||||
[list_to_atom(Proto), list_to_atom(ListenOn) ,Error])
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
listeners(_) ->
|
listeners(_) ->
|
||||||
?USAGE([{"listeners", "List listeners"},
|
?USAGE([{"listeners", "List listeners"},
|
||||||
{"listeners restart <Proto> <Port>", "Restart a listener port"},
|
{"listeners restart <Proto> <Port>", "Restart a listener"},
|
||||||
{"listeners stop <Proto> <Port>", "Stop a listener port"}]).
|
{"listeners stop <Proto> <Port>", "Stop a listener"}]).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Dump ETS
|
%% Dump ETS
|
||||||
|
|
Loading…
Reference in New Issue