#!/usr/bin/env bash

REPLICA_COUNT=`docker service inspect $1 | jq '.[0].Spec.Mode.Replicated.Replicas'`
./timeout.sh -t $2 docker service scale $1=$(($REPLICA_COUNT*2))
./timeout.sh -t $2 docker service scale $1=$(($REPLICA_COUNT))
docker service update -q $1
