Here is how this script can be used:
./docker-service-update-wait.sh redis-slave 60 2 "docker service update --image redis:3.2.6-alpine --stop-grace-period 10s --update-delay 5s redis-slave"
Update command: docker service update --image redis:3.2.6-alpine --stop-grace-period 10s --update-delay 5s redis-slave
# of replicas: 3
Timeout/replica: 60 sec
Total timeout: 180 sec
Stability delay: 2 sec
Updating service: redis-slave
Remaining replicas: 3 2 1 done
Stability test: done
SUCCESS