Allow multiweave to be run from any directory

This commit is contained in:
David Wragg committed 2015-04-08 18:16:10 +01:00
1 parent 580ffc4fa4
commit 74dae2abb4
1 file changed
+5 -3
+5 -3
View File
@@ -5,10 +5,12 @@ START=${FIRST_WEAVE:-1}
COUNT=${NUM_WEAVES:-28} COUNT=${NUM_WEAVES:-28}
FINISH=$((START+COUNT-1)) FINISH=$((START+COUNT-1))
weavedir=$(dirname $0)/..
case "$1" in case "$1" in
launch) launch)
for i in $(seq $START $FINISH); do for i in $(seq $START $FINISH); do
WEAVE_CONTAINER_NAME=weave$i ./weave --local test-launch --connlimit=100 WEAVE_CONTAINER_NAME=weave$i $weavedir/weave --local test-launch --connlimit=100
done done
if [ $START -ne 1 ] ; then if [ $START -ne 1 ] ; then
status=$(docker inspect --format='{{.State.Running}} {{.NetworkSettings.IPAddress}}' weave$((START-1))) status=$(docker inspect --format='{{.State.Running}} {{.NetworkSettings.IPAddress}}' weave$((START-1)))
@@ -17,7 +19,7 @@ case "$1" in
for i in $(seq $START $FINISH); do for i in $(seq $START $FINISH); do
if [ -n "$PREV" ] ; then if [ -n "$PREV" ] ; then
echo connecting weave$i to $PREV echo connecting weave$i to $PREV
WEAVE_CONTAINER_NAME=weave$i ./weave --local connect $PREV WEAVE_CONTAINER_NAME=weave$i $weavedir/weave --local connect $PREV
fi fi
status=$(docker inspect --format='{{.State.Running}} {{.NetworkSettings.IPAddress}}' weave$i) status=$(docker inspect --format='{{.State.Running}} {{.NetworkSettings.IPAddress}}' weave$i)
PREV="${status#true }" PREV="${status#true }"
@@ -26,7 +28,7 @@ case "$1" in
stop) stop)
for i in $(seq $START $FINISH); do for i in $(seq $START $FINISH); do
echo Stopping weave$i echo Stopping weave$i
WEAVE_CONTAINER_NAME=weave$i ./weave --local stop WEAVE_CONTAINER_NAME=weave$i $weavedir/weave --local stop
done done
;; ;;
esac esac