aboutsummaryrefslogtreecommitdiffstats
path: root/priv/templates
diff options
context:
space:
mode:
authorLuis Rascao <[email protected]>2017-05-14 02:15:05 +0100
committerLuis Rascao <[email protected]>2017-05-15 17:27:56 +0100
commit82f6c94a4d8ef1cf2be0becc5816d0646e5a50cc (patch)
tree0859e7e9a796f69dd26ebc015c8c7b0ca9d5f199 /priv/templates
parentc1fa56db1ec4cc4aa6975f4efee0c189452a251d (diff)
downloadrelx-82f6c94a4d8ef1cf2be0becc5816d0646e5a50cc.tar.gz
relx-82f6c94a4d8ef1cf2be0becc5816d0646e5a50cc.tar.bz2
relx-82f6c94a4d8ef1cf2be0becc5816d0646e5a50cc.zip
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.
Diffstat (limited to 'priv/templates')
-rw-r--r--priv/templates/builtin_hook_status3
-rwxr-xr-xpriv/templates/extended_bin15
2 files changed, 17 insertions, 1 deletions
diff --git a/priv/templates/builtin_hook_status b/priv/templates/builtin_hook_status
new file mode 100644
index 0000000..e5dd792
--- /dev/null
+++ b/priv/templates/builtin_hook_status
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo $(relx_nodetool eval "application:which_applications().")
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 <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|downgrade|install|uninstall|versions|escript|rpc|rpcterms|eval}"
+ echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|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