aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2014-12-24 14:30:37 -0600
committerTristan Sloughter <[email protected]>2014-12-24 14:30:37 -0600
commita02632781c903e5a74d9731c89686ea522cc8590 (patch)
treec8adb0aaf3734d41c6ed135259b31cb4456ff2a8
parent8a64fd860e354cd3c32b5d6471052314bdd50674 (diff)
parent95a3ec0ea6e2defd720295c4f71c2d0313d00656 (diff)
downloadrelx-a02632781c903e5a74d9731c89686ea522cc8590.tar.gz
relx-a02632781c903e5a74d9731c89686ea522cc8590.tar.bz2
relx-a02632781c903e5a74d9731c89686ea522cc8590.zip
Merge pull request #284 from lukebakken/features/lrb/get-node-pid
Use nodetool to get VM PID
-rw-r--r--priv/templates/extended_bin.dtl30
1 files changed, 13 insertions, 17 deletions
diff --git a/priv/templates/extended_bin.dtl b/priv/templates/extended_bin.dtl
index 751b01f..8429a5e 100644
--- a/priv/templates/extended_bin.dtl
+++ b/priv/templates/extended_bin.dtl
@@ -26,6 +26,11 @@ find_erts_dir() {
fi
}
+# Get node pid
+relx_get_pid() {
+ relx_nodetool rpcterms os getpid | sed -e 's/"//g'
+}
+
# Connect to a remote node
relx_rem_sh() {
# Generate a unique id used to allow multiple remsh to the same node
@@ -61,6 +66,7 @@ relx_escript() {
"$ERTS_DIR/bin/escript" "$ROOTDIR/$scriptpath" $@
}
+
# Output a start command for the last argument of run_erl
relx_start_command() {
printf "exec \"%s\" \"%s\"" "$RELEASE_ROOT_DIR/bin/$REL_NAME" \
@@ -194,22 +200,7 @@ case "$1" in
stop)
# Wait for the node to completely stop...
- case $(uname -s) in
- Linux|Darwin|FreeBSD|DragonFly|NetBSD|OpenBSD)
- # PID COMMAND
- PID=$(ps ax -o pid= -o command=|
- grep "$RELEASE_ROOT_DIR/.*/[b]eam"|awk '{print $1}')
- ;;
- SunOS)
- # PID COMMAND
- PID=$(ps -ef -o pid= -o args=|
- grep "$RELEASE_ROOT_DIR/.*/[b]eam"|awk '{print $1}')
- ;;
- CYGWIN*)
- # UID PID PPID TTY STIME COMMAND
- PID=$(ps -efw|grep "$RELEASE_ROOT_DIR/.*/[b]eam"|awk '{print $2}')
- ;;
- esac
+ PID="$(relx_get_pid)"
if ! relx_nodetool "stop"; then
exit $?
fi
@@ -233,6 +224,11 @@ case "$1" in
fi
;;
+ pid)
+ ## Get the VM's pid
+ echo "$(relx_get_pid)"
+ ;;
+
ping)
## See if the VM is alive
if ! relx_nodetool "ping"; then
@@ -372,7 +368,7 @@ case "$1" in
exec "$@" -- ${1+$ARGS}
;;
*)
- echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|escript}"
+ echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|escript}"
exit 1
;;
esac