aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2014-12-25 12:51:07 -0600
committerTristan Sloughter <[email protected]>2014-12-25 12:51:07 -0600
commitec06fbcaf9a79ba3b5f34b4a597da4a1e7e04286 (patch)
treeaf40991b61520cd09f72d726d2513b23891e5060
parenta02632781c903e5a74d9731c89686ea522cc8590 (diff)
parent64c3f5932b22daec8588728216fd0752273d4dca (diff)
downloadrelx-ec06fbcaf9a79ba3b5f34b4a597da4a1e7e04286.tar.gz
relx-ec06fbcaf9a79ba3b5f34b4a597da4a1e7e04286.tar.bz2
relx-ec06fbcaf9a79ba3b5f34b4a597da4a1e7e04286.zip
Merge pull request #287 from lukebakken/issues/lrb/286
Explicitly use 'exit 1' to exit
-rw-r--r--priv/templates/extended_bin.dtl32
1 files changed, 19 insertions, 13 deletions
diff --git a/priv/templates/extended_bin.dtl b/priv/templates/extended_bin.dtl
index 8429a5e..70b4ee2 100644
--- a/priv/templates/extended_bin.dtl
+++ b/priv/templates/extended_bin.dtl
@@ -28,7 +28,14 @@ find_erts_dir() {
# Get node pid
relx_get_pid() {
- relx_nodetool rpcterms os getpid | sed -e 's/"//g'
+ if output="$(relx_nodetool rpcterms os getpid)"
+ then
+ echo "$output" | sed -e 's/"//g'
+ return 0
+ else
+ echo "$output"
+ return 1
+ fi
}
# Connect to a remote node
@@ -202,7 +209,7 @@ case "$1" in
# Wait for the node to completely stop...
PID="$(relx_get_pid)"
if ! relx_nodetool "stop"; then
- exit $?
+ exit 1
fi
while $(kill -0 "$PID" 2>/dev/null);
do
@@ -213,42 +220,43 @@ case "$1" in
restart)
## Restart the VM without exiting the process
if ! relx_nodetool "restart"; then
- exit $?
+ exit 1
fi
;;
reboot)
## Restart the VM completely (uses heart to restart it)
if ! relx_nodetool "reboot"; then
- exit $?
+ exit 1
fi
;;
pid)
## Get the VM's pid
- echo "$(relx_get_pid)"
+ if ! relx_get_pid; then
+ exit 1
+ fi
;;
ping)
## See if the VM is alive
if ! relx_nodetool "ping"; then
- exit $?
+ exit 1
fi
;;
escript)
## Run an escript under the node's environment
if ! relx_escript $@; then
- exit $?
+ exit 1
fi
;;
attach)
# Make sure a node IS running
if ! relx_nodetool "ping" > /dev/null; then
- ES="$?"
echo "Node is not running!"
- exit $ES
+ exit 1
fi
shift
@@ -258,9 +266,8 @@ case "$1" in
remote_console)
# Make sure a node IS running
if ! relx_nodetool "ping" > /dev/null; then
- ES="$?"
echo "Node is not running!"
- exit $ES
+ exit 1
fi
shift
@@ -277,9 +284,8 @@ case "$1" in
# Make sure a node IS running
if ! relx_nodetool "ping" > /dev/null; then
- ES="$?"
echo "Node is not running!"
- exit $ES
+ exit 1
fi
exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \