refactor(bin/emqx): refine help info
* refine usage print * deleted restart command, as it only works for daemon mode. e.g. if EMQ X is started in 'foreground' mode the 'restart' command will make it start in daemon mode * some commands such as ertspath does not requre RPC
This commit is contained in:
parent
32d1547c03
commit
38ee224fac
80
bin/emqx
80
bin/emqx
|
@ -85,14 +85,23 @@ usage() {
|
||||||
stop)
|
stop)
|
||||||
echo "Stop the running EMQ X program"
|
echo "Stop the running EMQ X program"
|
||||||
;;
|
;;
|
||||||
restart|reboot)
|
console)
|
||||||
echo "Restart $EMQX_DESCRIPTION"
|
echo "Boot up EMQ X service in an interactive Erlang or Elixir shell"
|
||||||
|
echo "This command needs a tty"
|
||||||
|
;;
|
||||||
|
console_clean)
|
||||||
|
echo "This command does NOT boot up the EMQ X service"
|
||||||
|
echo "It only starts an interactive Erlang or Elixir console with all the"
|
||||||
|
echo "EMQ X code available"
|
||||||
|
;;
|
||||||
|
foreground)
|
||||||
|
echo "Start EMQ X in foreground mode without an interactive shell"
|
||||||
;;
|
;;
|
||||||
pid)
|
pid)
|
||||||
echo "Print out $EMQX_DESCRIPTION process identifier"
|
echo "Print out EMQ X process identifier"
|
||||||
;;
|
;;
|
||||||
ping)
|
ping)
|
||||||
echo "Check if the $EMQX_DESCRIPTION node is up and running"
|
echo "Check if the EMQ X node is up and running"
|
||||||
echo "This command exit with 0 silently if node is running"
|
echo "This command exit with 0 silently if node is running"
|
||||||
;;
|
;;
|
||||||
escript)
|
escript)
|
||||||
|
@ -100,47 +109,36 @@ usage() {
|
||||||
echo "For example $REL_NAME escript /path/to/my/escript my_arg1 my_arg2"
|
echo "For example $REL_NAME escript /path/to/my/escript my_arg1 my_arg2"
|
||||||
;;
|
;;
|
||||||
attach)
|
attach)
|
||||||
echo "This command is applicable when $EMQX_DESCRIPTION is started in daemon"
|
echo "This command is applicable when EMQ X is started in daemon"
|
||||||
echo "mode. it attaches the current shell to EMQ X's control console"
|
echo "mode. it attaches the current shell to EMQ X's control console"
|
||||||
echo "through a named pipe"
|
echo "through a named pipe"
|
||||||
echo "WARNING: try to use the safer alternative, remote_console command."
|
echo "WARNING: try to use the safer alternative, remote_console command."
|
||||||
;;
|
;;
|
||||||
remote_console)
|
remote_console)
|
||||||
echo "Start a dummy Erlang node and hidden-connect $EMQX_DESCRIPTION to"
|
echo "Start a dummy Erlang or Elixir node and hidden-connect EMQ X to"
|
||||||
echo "with an interactive Erlang shell"
|
echo "with an interactive Erlang or Elixir shell"
|
||||||
;;
|
|
||||||
console)
|
|
||||||
echo "Boot up $EMQX_DESCRIPTION service in an interactive Erlang shell"
|
|
||||||
echo "This command is useful for troubleshooting"
|
|
||||||
;;
|
|
||||||
console_clean)
|
|
||||||
echo "This command does NOT boot up the $EMQX_DESCRIPTION service"
|
|
||||||
echo "It only starts an interactive Erlang console with all the"
|
|
||||||
echo "EMQ X code available"
|
|
||||||
;;
|
|
||||||
foreground)
|
|
||||||
echo "Start $EMQX_DESCRIPTION in foreground mode"
|
|
||||||
;;
|
;;
|
||||||
ertspath)
|
ertspath)
|
||||||
echo "Print path to Erlang runtime dir"
|
echo "Print path to Erlang runtime dir"
|
||||||
;;
|
;;
|
||||||
rpc)
|
rpc)
|
||||||
echo "Usge $REL_NAME rpc MODULE FUNCTION [ARGS, ...]"
|
echo "Usge $REL_NAME rpc MODULE FUNCTION [ARGS, ...]"
|
||||||
echo "Connect to the $EMQX_DESCRIPTION node and make an Erlang RPC"
|
echo "Connect to the EMQ X node and make an Erlang RPC"
|
||||||
echo "The result of the RPC call must be 'ok'"
|
echo "This command blocks for at most 60 seconds."
|
||||||
echo "This command blocks for at most 60 seconds in case the node"
|
echo "It exits with non-zero code in case of any RPC failure"
|
||||||
echo "does not reply the call in time"
|
echo "including connection error and runtime exception"
|
||||||
;;
|
;;
|
||||||
rpcterms)
|
rpcterms)
|
||||||
echo "Usge $REL_NAME rpcterms MODULE FUNCTION [ARGS, ...]"
|
echo "Usge $REL_NAME rpcterms MODULE FUNCTION [ARGS, ...]"
|
||||||
echo "Connect to the $EMQX_DESCRIPTION node and make an Erlang RPC"
|
echo "Connect to the EMQ X node and make an Erlang RPC"
|
||||||
echo "The result of the RPC call is pretty-printed as an Erlang term"
|
echo "The result of the RPC call is pretty-printed as an "
|
||||||
|
echo "Erlang term"
|
||||||
;;
|
;;
|
||||||
root_dir)
|
root_dir)
|
||||||
echo "Print EMQ X installation root dir"
|
echo "Print EMQ X installation root dir"
|
||||||
;;
|
;;
|
||||||
eval)
|
eval)
|
||||||
echo "Evaluate an Erlang expression in the EMQ X node"
|
echo "Evaluate an Erlang or Elxir expression in the EMQ X node"
|
||||||
;;
|
;;
|
||||||
versions)
|
versions)
|
||||||
echo "List installed EMQ X versions and their status"
|
echo "List installed EMQ X versions and their status"
|
||||||
|
@ -192,7 +190,23 @@ usage() {
|
||||||
echo " don't make it permanent"
|
echo " don't make it permanent"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $REL_NAME {start|ertspath|foreground|stop|pid|ping|console|console_clean|attach|remote_console|upgrade|downgrade|install|uninstall|versions|escript|ctl|rpc|rpcterms|eval|root_dir} <help>"
|
echo "Usage: $REL_NAME COMMAND [help]"
|
||||||
|
echo ''
|
||||||
|
echo "Commonly used COMMANDs:"
|
||||||
|
echo " start: Start EMQ X in daemon mode"
|
||||||
|
echo " console: Start EMQ X in an interactive Erlang or Elixir shell"
|
||||||
|
echo " foreground: Start EMQ X in foreground mode without an interactive shell"
|
||||||
|
echo " stop: Stop the running EMQ X node"
|
||||||
|
echo " ctl: Administration commands, execute '$REL_NAME ctl help' for more details"
|
||||||
|
echo ''
|
||||||
|
echo "More:"
|
||||||
|
echo " Shell attach: remote_console | attach"
|
||||||
|
echo " Up/Down-grade: upgrade | downgrade | install | uninstall"
|
||||||
|
echo " Install info: ertspath | root_dir | versions | root_dir"
|
||||||
|
echo " Runtime info: pid | ping | versions"
|
||||||
|
echo " Advanced: console_clean | escript | rpc | rpcterms | eval"
|
||||||
|
echo ''
|
||||||
|
echo "Execute '$REL_NAME COMMAND help' for more information"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -498,6 +512,10 @@ case "${COMMAND}" in
|
||||||
start|console|console_clean|foreground)
|
start|console|console_clean|foreground)
|
||||||
IS_BOOT_COMMAND='yes'
|
IS_BOOT_COMMAND='yes'
|
||||||
;;
|
;;
|
||||||
|
ertspath)
|
||||||
|
echo "$ERTS_PATH"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
IS_BOOT_COMMAND='no'
|
IS_BOOT_COMMAND='no'
|
||||||
;;
|
;;
|
||||||
|
@ -636,11 +654,6 @@ case "${COMMAND}" in
|
||||||
logger -t "${REL_NAME}[${PID}]" "STOP: OK"
|
logger -t "${REL_NAME}[${PID}]" "STOP: OK"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
restart|reboot)
|
|
||||||
echo "$EMQX_DESCRIPTION $REL_VSN is stopped: $("$RUNNER_BIN_DIR/$REL_NAME" stop)"
|
|
||||||
"$RUNNER_BIN_DIR/$REL_NAME" start
|
|
||||||
;;
|
|
||||||
|
|
||||||
pid)
|
pid)
|
||||||
## Get the VM's pid
|
## Get the VM's pid
|
||||||
if ! relx_get_pid; then
|
if ! relx_get_pid; then
|
||||||
|
@ -815,9 +828,6 @@ case "${COMMAND}" in
|
||||||
# Start the VM
|
# Start the VM
|
||||||
exec "$@" -- ${1+$ARGS}
|
exec "$@" -- ${1+$ARGS}
|
||||||
;;
|
;;
|
||||||
ertspath)
|
|
||||||
echo "$ERTS_PATH"
|
|
||||||
;;
|
|
||||||
ctl)
|
ctl)
|
||||||
assert_node_alive
|
assert_node_alive
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue