mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Add ability to disable timeout for ejabberdctl command
This commit is contained in:
parent
5ce0b062ff
commit
7a69dab596
@ -48,6 +48,7 @@ while [ $# -ne 0 ] ; do
|
|||||||
shift
|
shift
|
||||||
case $PARAM in
|
case $PARAM in
|
||||||
--) break ;;
|
--) break ;;
|
||||||
|
--no-timeout) EJABBERD_NO_TIMEOUT="--no-timeout" ;;
|
||||||
--node) ERLANG_NODE_ARG=$1 ; shift ;;
|
--node) ERLANG_NODE_ARG=$1 ; shift ;;
|
||||||
--config-dir) ETC_DIR="$1" ; shift ;;
|
--config-dir) ETC_DIR="$1" ; shift ;;
|
||||||
--config) EJABBERD_CONFIG_PATH="$1" ; shift ;;
|
--config) EJABBERD_CONFIG_PATH="$1" ; shift ;;
|
||||||
@ -418,7 +419,7 @@ ctlexec()
|
|||||||
-hidden \
|
-hidden \
|
||||||
-pa $EJABBERD_EBIN_PATH \
|
-pa $EJABBERD_EBIN_PATH \
|
||||||
$KERNEL_OPTS \
|
$KERNEL_OPTS \
|
||||||
-s ejabberd_ctl -extra $ERLANG_NODE $COMMAND"
|
-s ejabberd_ctl -extra $ERLANG_NODE $EJABBERD_NO_TIMEOUT $COMMAND"
|
||||||
}
|
}
|
||||||
|
|
||||||
# stop epmd if there is no other running node
|
# stop epmd if there is no other running node
|
||||||
|
@ -63,37 +63,40 @@
|
|||||||
%%-----------------------------
|
%%-----------------------------
|
||||||
|
|
||||||
start() ->
|
start() ->
|
||||||
case init:get_plain_arguments() of
|
[SNode, Timeout, Args] = case init:get_plain_arguments() of
|
||||||
[SNode | Args] ->
|
[SNode2, "--no-timeout" | Args2] ->
|
||||||
SNode1 = case string:tokens(SNode, "@") of
|
[SNode2, infinity, Args2];
|
||||||
[_Node, _Server] ->
|
[SNode3 | Args3] ->
|
||||||
SNode;
|
[SNode3, 10000, Args3];
|
||||||
_ ->
|
_ ->
|
||||||
case net_kernel:longnames() of
|
print_usage(),
|
||||||
true ->
|
halt(?STATUS_USAGE)
|
||||||
lists:flatten([SNode, "@", inet_db:gethostname(),
|
end,
|
||||||
".", inet_db:res_option(domain)]);
|
SNode1 = case string:tokens(SNode, "@") of
|
||||||
false ->
|
[_Node, _Server] ->
|
||||||
lists:flatten([SNode, "@", inet_db:gethostname()]);
|
SNode;
|
||||||
_ ->
|
_ ->
|
||||||
SNode
|
case net_kernel:longnames() of
|
||||||
end
|
true ->
|
||||||
end,
|
lists:flatten([SNode, "@", inet_db:gethostname(),
|
||||||
Node = list_to_atom(SNode1),
|
".", inet_db:res_option(domain)]);
|
||||||
Status = case rpc:call(Node, ?MODULE, process, [Args], 60000) of
|
false ->
|
||||||
{badrpc, Reason} ->
|
lists:flatten([SNode, "@", inet_db:gethostname()]);
|
||||||
print("Failed RPC connection to the node ~p: ~p~n",
|
_ ->
|
||||||
[Node, Reason]),
|
SNode
|
||||||
%% TODO: show minimal start help
|
end
|
||||||
?STATUS_BADRPC;
|
end,
|
||||||
S ->
|
Node = list_to_atom(SNode1),
|
||||||
S
|
Status = case rpc:call(Node, ?MODULE, process, [Args], Timeout) of
|
||||||
end,
|
{badrpc, Reason} ->
|
||||||
halt(Status);
|
print("Failed RPC connection to the node ~p: ~p~n",
|
||||||
_ ->
|
[Node, Reason]),
|
||||||
print_usage(),
|
%% TODO: show minimal start help
|
||||||
halt(?STATUS_USAGE)
|
?STATUS_BADRPC;
|
||||||
end.
|
S ->
|
||||||
|
S
|
||||||
|
end,
|
||||||
|
halt(Status).
|
||||||
|
|
||||||
init() ->
|
init() ->
|
||||||
ets:new(ejabberd_ctl_cmds, [named_table, set, public]),
|
ets:new(ejabberd_ctl_cmds, [named_table, set, public]),
|
||||||
@ -470,7 +473,7 @@ print_usage(HelpMode, MaxC, ShCode) ->
|
|||||||
get_list_ctls(),
|
get_list_ctls(),
|
||||||
|
|
||||||
print(
|
print(
|
||||||
["Usage: ", ?B("ejabberdctl"), " [--node ", ?U("nodename"), "] [--auth ",
|
["Usage: ", ?B("ejabberdctl"), " [--no-timeout] [--node ", ?U("nodename"), "] [--auth ",
|
||||||
?U("user"), " ", ?U("host"), " ", ?U("password"), "] ",
|
?U("user"), " ", ?U("host"), " ", ?U("password"), "] ",
|
||||||
?U("command"), " [", ?U("options"), "]\n"
|
?U("command"), " [", ?U("options"), "]\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user