Propagate exit status from nodetool to runner script

This commit is contained in:
Andrew Thompson 2011-07-07 11:53:01 -04:00 committed by Tuncer Ayaz
parent c63002bef8
commit 6749bb6ac0

View file

@ -85,6 +85,10 @@ case "$1" in
;; ;;
esac esac
$NODETOOL stop $NODETOOL stop
ES=$?
if [ "$ES" -ne 0 ]; then
exit $ES
fi
while `kill -0 $PID 2>/dev/null`; while `kill -0 $PID 2>/dev/null`;
do do
sleep 1 sleep 1
@ -94,28 +98,41 @@ case "$1" in
restart) restart)
## Restart the VM without exiting the process ## Restart the VM without exiting the process
$NODETOOL restart $NODETOOL restart
ES=$?
if [ "$ES" -ne 0 ]; then
exit $ES
fi
;; ;;
reboot) reboot)
## Restart the VM completely (uses heart to restart it) ## Restart the VM completely (uses heart to restart it)
$NODETOOL reboot $NODETOOL reboot
ES=$?
if [ "$ES" -ne 0 ]; then
exit $ES
fi
;; ;;
ping) ping)
## See if the VM is alive ## See if the VM is alive
$NODETOOL ping $NODETOOL ping
ES=$?
if [ "$ES" -ne 0 ]; then
exit $ES
fi
;; ;;
attach) attach)
# Make sure a node IS running # Make sure a node IS running
RES=`$NODETOOL ping` RES=`$NODETOOL ping`
if [ "$RES" != "pong" ]; then ES=$?
if [ "$ES" -ne 0 ]; then
echo "Node is not running!" echo "Node is not running!"
exit 1 exit $ES
fi fi
shift shift
$ERTS_PATH/to_erl $PIPE_DIR exec $ERTS_PATH/to_erl $PIPE_DIR
;; ;;
console|console_clean) console|console_clean)