Merge remote-tracking branch 'upstream/master' into 23_retry_peers
This commit is contained in:
commit
ef35839d4b
1 file changed
+26
-5
+26
-5
@@ -82,14 +82,34 @@ case "$COMMAND" in
|
|||||||
# (eth0, wlan0, etc) so the name becomes stable across host
|
# (eth0, wlan0, etc) so the name becomes stable across host
|
||||||
# restarts.
|
# restarts.
|
||||||
MACADDR=`cat /sys/class/net/$BRIDGE/address`
|
MACADDR=`cat /sys/class/net/$BRIDGE/address`
|
||||||
|
case $(docker inspect --format '{{ .State.Running }} {{ .Config.Image }}' weave 2>/dev/null) in
|
||||||
|
"true zettio/weave")
|
||||||
|
echo "Weave is already running." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
"false zettio/weave")
|
||||||
|
docker rm weave >/dev/null
|
||||||
|
;;
|
||||||
|
true*)
|
||||||
|
echo "Found another running container named 'weave'. Aborting." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
false*)
|
||||||
|
echo "Found another container named 'weave'. Aborting." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
CONTAINER=$(docker run --privileged -d --name=weave -p 6783:6783/tcp -p 6783:6783/udp $WEAVE_DOCKER_ARGS zettio/weave -name $MACADDR "$@")
|
CONTAINER=$(docker run --privileged -d --name=weave -p 6783:6783/tcp -p 6783:6783/udp $WEAVE_DOCKER_ARGS zettio/weave -name $MACADDR "$@")
|
||||||
echo $CONTAINER
|
echo $CONTAINER
|
||||||
IFACE=eth0
|
IFACE=eth0
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
DOCKERIP=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' weave)
|
if ! DOCKERIP=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' weave 2>/dev/null) ; then
|
||||||
|
echo "Weave is not running." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if [ -z "$DOCKERIP" ] ; then
|
if [ -z "$DOCKERIP" ] ; then
|
||||||
echo "The weave container is not running." >&2
|
echo "Weave is not running." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if command_exists wget ; then
|
if command_exists wget ; then
|
||||||
@@ -132,8 +152,9 @@ case "$COMMAND" in
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
docker kill weave > /dev/null
|
if ! docker rm -f weave >/dev/null 2>&1 ; then
|
||||||
docker rm weave > /dev/null
|
echo "Weave is not running."
|
||||||
|
fi
|
||||||
if command_exists conntrack
|
if command_exists conntrack
|
||||||
then
|
then
|
||||||
conntrack -D -p udp --dport 6783 >/dev/null 2>&1
|
conntrack -D -p udp --dport 6783 >/dev/null 2>&1
|
||||||
@@ -178,7 +199,7 @@ ip netns exec $NSPID ip link set $CONTAINER_IFNAME up
|
|||||||
|
|
||||||
if command_exists ethtool
|
if command_exists ethtool
|
||||||
then
|
then
|
||||||
ip netns exec $NSPID ethtool -K $IFACE tx off > /dev/null
|
ip netns exec $NSPID ethtool -K $IFACE tx off >/dev/null
|
||||||
else
|
else
|
||||||
echo "Cannot find ethtool; please install it. Continuing without it." >&2
|
echo "Cannot find ethtool; please install it. Continuing without it." >&2
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user