From c1fa56db1ec4cc4aa6975f4efee0c189452a251d Mon Sep 17 00:00:00 2001 From: Luis Rascao Date: Sun, 14 May 2017 02:11:26 +0100 Subject: Ensure mustache does not html escape hook invocations --- priv/templates/extended_bin | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'priv/templates/extended_bin') diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index f05fb31..3090368 100755 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -40,12 +40,13 @@ ERL_OPTS="{{ erl_opts }}" RUNNER_LOG_DIR="${RUNNER_LOG_DIR:-$RELEASE_ROOT_DIR/log}" # start/stop/install/upgrade pre/post hooks -PRE_START_HOOKS="{{ pre_start_hooks }}" -POST_START_HOOKS="{{ post_start_hooks }}" -PRE_STOP_HOOKS="{{ pre_stop_hooks }}" -POST_STOP_HOOKS="{{ post_stop_hooks }}" -PRE_INSTALL_UPGRADE_HOOKS="{{ pre_install_upgrade_hooks }}" -POST_INSTALL_UPGRADE_HOOKS="{{ post_install_upgrade_hooks }}" +PRE_START_HOOKS="{{{ pre_start_hooks }}}" +POST_START_HOOKS="{{{ post_start_hooks }}}" +PRE_STOP_HOOKS="{{{ pre_stop_hooks }}}" +POST_STOP_HOOKS="{{{ post_stop_hooks }}}" +PRE_INSTALL_UPGRADE_HOOKS="{{{ pre_install_upgrade_hooks }}}" +POST_INSTALL_UPGRADE_HOOKS="{{{ post_install_upgrade_hooks }}}" +STATUS_HOOK="{{{ status_hook }}}" relx_usage() { command="$1" -- cgit v1.2.3 From 82f6c94a4d8ef1cf2be0becc5816d0646e5a50cc Mon Sep 17 00:00:00 2001 From: Luis Rascao Date: Sun, 14 May 2017 02:15:05 +0100 Subject: Add custom status hook to extended script Provide a status command to start script which, by default, runs a builtin hook that simply prints which applications are running in the node. This hook can then be customized to print whatever the user wants by adding {status, [{custom, "path/to/hook"}]} to already existing extended_start_script_hooks. --- priv/templates/extended_bin | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'priv/templates/extended_bin') diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index 3090368..ed68748 100755 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -102,8 +102,12 @@ relx_usage() { echo " --no-permanent Install release package VERSION but" echo " don't make it permanent" ;; + status) + echo "Usage: $REL_NAME status" + echo "Obtains node status information." + ;; *) - echo "Usage: $REL_NAME {start|start_boot |foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot |attach|remote_console|upgrade|downgrade|install|uninstall|versions|escript|rpc|rpcterms|eval}" + echo "Usage: $REL_NAME {start|start_boot |foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot |attach|remote_console|upgrade|downgrade|install|uninstall|versions|escript|rpc|rpcterms|eval|status}" ;; esac } @@ -585,6 +589,15 @@ case "$1" in shift relx_nodetool "eval" $@ ;; + status) + # Make sure a node IS running + if ! relx_nodetool "ping" > /dev/null; then + echo "Node is not running!" + exit 1 + fi + + [ "$SCRIPT_DIR/$STATUS_HOOK" ] && . "$SCRIPT_DIR/$STATUS_HOOK" $@ + ;; help) if [ -z "$2" ]; then relx_usage -- cgit v1.2.3