diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2016-03-18 15:21:15 +0100 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2016-03-18 15:36:10 +0100 |
| commit | 9cfd5bd64edd527db418ea2cbbb35d53054bfad5 (patch) | |
| tree | c562380fbacd92fc09fa0891ae0c5c04fb7d2019 /src | |
| parent | d9851bdde8deb7a784738c25370e9a2a9b7637fc (diff) | |
| download | rabbitmq-server-git-9cfd5bd64edd527db418ea2cbbb35d53054bfad5.tar.gz | |
"rabbitmqctl stop" exits with 0 if it fails to contact the node
If rabbitmqctl fails to contact the node to ask it to stop, it still
displays an error message. However, now it exits with 0; it was
EX_UNAVAILABLE before.
There are two main reasons it can happen:
o The node is stopped, so that's ok to exit with 0 because the end
result is the same.
o The Erlang cookie is incorrect. The error message is here to help
but this situation is quite rare compared to the other one.
There is no way to distinguish both, so let's assume the common
situation.
This helps in the case of systemd in particular: if one stops RabbitMQ
using "rabbitmqctl stop" instead of "service rabbitmq-server stop",
systemd tries to call "rabbitmqctl stop" again. Before this change, it
failed and put the service in a "failed" state.
Fixes #693.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_cli.erl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rabbit_cli.erl b/src/rabbit_cli.erl index 6679d9329e..086f88d9f6 100644 --- a/src/rabbit_cli.erl +++ b/src/rabbit_cli.erl @@ -117,7 +117,10 @@ main(ParseFun, DoFun, UsageMod) -> _ -> print_error("unable to connect to node ~w: ~w", [Node, Reason]), print_badrpc_diagnostics([Node]), - rabbit_misc:quit(?EX_UNAVAILABLE) + case Command of + stop -> rabbit_misc:quit(?EX_OK); + _ -> rabbit_misc:quit(?EX_UNAVAILABLE) + end end; {badrpc_multi, Reason, Nodes} -> print_error("unable to connect to nodes ~p: ~w", [Nodes, Reason]), |
