aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Santos <[email protected]>2018-06-15 15:27:40 -0400
committerTristan Sloughter <[email protected]>2018-06-15 13:27:40 -0600
commitcc85c34d483539acbf4f249b6add7c20de29f39d (patch)
treeef21caaebfe3206b13a5a24512a99be1dec65223
parentee477fb31ad9a7603aaea8922aaa9ecd3712ee2d (diff)
downloadrelx-cc85c34d483539acbf4f249b6add7c20de29f39d.tar.gz
relx-cc85c34d483539acbf4f249b6add7c20de29f39d.tar.bz2
relx-cc85c34d483539acbf4f249b6add7c20de29f39d.zip
Start script (#635)
* templates/bin: replace process with erlexec Similar to templates/extended_bin, use "exec" to avoid leaving an extra shell process running. * template/{bin,extended_bin}: set program name Set the program name to the script name in process lists using the same method as escripts. The program name can be overriden by setting the ESCRIPT_NAME environment variable: # before msantos 10428 9554 49 10:33 pts/25 00:00:01 /usr/local/lib/erlang/erts-9.2/bin/beam.smp -Bd -- ... # after msantos 10054 9554 32 10:33 pts/25 00:00:01 /home/msantos/src/erlang/appname/_build/default/rel/appname/bin/appname -Bd -- ... # ESCRIPT_NAME="foo" msantos 11254 9554 32 10:35 pts/25 00:00:01 foo -Bd -- ...
-rwxr-xr-xpriv/templates/bin3
-rwxr-xr-xpriv/templates/extended_bin1
2 files changed, 3 insertions, 1 deletions
diff --git a/priv/templates/bin b/priv/templates/bin
index 523b88d..e2a54be 100755
--- a/priv/templates/bin
+++ b/priv/templates/bin
@@ -13,6 +13,7 @@ REL_VSN="{{ rel_vsn }}"
ERTS_VSN="{{ erts_vsn }}"
REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN"
ERL_OPTS="{{ erl_opts }}"
+export ESCRIPT_NAME="${ESCRIPT_NAME-$SCRIPT}"
find_erts_dir() {
__erts_dir="$RELEASE_ROOT_DIR/erts-$ERTS_VSN"
@@ -74,4 +75,4 @@ set -- "$ERL_OPTS"
set -- "$@" -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" -boot "$REL_DIR/$BOOTFILE" "$ARGS"
# Boot the release
-$BINDIR/erlexec $@
+exec $BINDIR/erlexec $@
diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin
index d044a38..11a0abc 100755
--- a/priv/templates/extended_bin
+++ b/priv/templates/extended_bin
@@ -38,6 +38,7 @@ CODE_LOADING_MODE="${CODE_LOADING_MODE:-embedded}"
REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN"
ERL_OPTS="{{ erl_opts }}"
RUNNER_LOG_DIR="${RUNNER_LOG_DIR:-$RELEASE_ROOT_DIR/log}"
+export ESCRIPT_NAME="${ESCRIPT_NAME-$SCRIPT}"
# start/stop/install/upgrade pre/post hooks
PRE_START_HOOKS="{{{ pre_start_hooks }}}"