Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #200 from runejuhl/issue/146

Fixes evanmiller#146 by checking for "ERROR" output.
  • Loading branch information...
commit 20d0d40b1a196e5f4086ebf3a58bdee615f665e8 2 parents 1bf2076 + 1ad9fc4
@evanmiller evanmiller authored
Showing with 15 additions and 5 deletions.
  1. +15 −5 skel/init.sh
View
20 skel/init.sh
@@ -3,12 +3,22 @@
# Chicago Boss Init System
#
# @author: Jose Luis Gordo Romero <jgordor@gmail.com>
+# @author: Rune Juhl Jacobsen <rune@juhljacobsen.dk>
#
# -------------------------------------------------------------------
# The shell commands are automatically generated by the boss rebar
# plugin/driver, all configuration params and paths are in boss.config
# -------------------------------------------------------------------
+do_start () {
+ if test $(echo "$1" | grep ERROR > /dev/null;echo $?) -eq 0
+ then
+ echo "$1"
+ else
+ eval $1
+ fi
+}
+
cd `dirname $0`
case "${1:-''}" in
@@ -16,13 +26,13 @@ case "${1:-''}" in
# Start Boss in production mode
echo "starting boss in production mode..."
START=$(./rebar boss c=start_cmd|grep -v "==>")
- $START
+ do_start "$START"
;;
'start-dev')
# Start Boss in development mode
START_DEV=$(./rebar boss c=start_dev_cmd|grep -v "==>")
- $START_DEV
+ do_start "$START_DEV"
;;
'stop')
@@ -31,14 +41,14 @@ case "${1:-''}" in
STOP=$(./rebar boss c=stop_cmd|grep -v "==>")
# After hours of shell quoting problems with the erl command,
# eval with the command quoted works!!!
- eval "$STOP"
+ do_start "$STOP"
;;
'reload')
# Boss hot code reload <-- only the actual node, not the entire cluster
echo "Hot code reload, (WARN: Only this node)"
RELOAD=$(./rebar boss c=reload_cmd|grep -v "==>")
- eval "$RELOAD"
+ do_start "$RELOAD"
;;
'restart')
@@ -52,4 +62,4 @@ case "${1:-''}" in
echo "Usage: $SELF start|start-dev|stop|reload|restart"
exit 1
;;
-esac
+esac
Please sign in to comment.
Something went wrong with that request. Please try again.