33 lines
1020 B
Bash
Executable File
33 lines
1020 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
START=${FIRST_WEAVE:-1}
|
|
COUNT=${NUM_WEAVES:-28}
|
|
FINISH=$((START+COUNT-1))
|
|
|
|
case "$1" in
|
|
launch)
|
|
for i in $(seq $START $FINISH); do
|
|
WEAVE_CONTAINER_NAME=weave$i ./weave --local test-launch --connlimit=100
|
|
done
|
|
if [ $START -ne 1 ] ; then
|
|
status=$(docker inspect --format='{{.State.Running}} {{.NetworkSettings.IPAddress}}' weave$((START-1)))
|
|
PREV="${status#true }"
|
|
fi
|
|
for i in $(seq $START $FINISH); do
|
|
if [ -n "$PREV" ] ; then
|
|
echo connecting weave$i to $PREV
|
|
WEAVE_CONTAINER_NAME=weave$i ./weave --local connect $PREV
|
|
fi
|
|
status=$(docker inspect --format='{{.State.Running}} {{.NetworkSettings.IPAddress}}' weave$i)
|
|
PREV="${status#true }"
|
|
done
|
|
;;
|
|
stop)
|
|
for i in $(seq $START $FINISH); do
|
|
echo Stopping weave$i
|
|
WEAVE_CONTAINER_NAME=weave$i ./weave --local stop
|
|
done
|
|
;;
|
|
esac
|