n=0 while : do docker login $1 --username client --password $2 \ && break # substitute your command here n=$((n+1)) echo "retrying login..$n" sleep 15 done docker login $1 --username client --password $2 sh $(dirname $0)/initialise-image.sh $1 drone/drone:1.9.0 \ && sh $(dirname $0)/initialise-image.sh $1 drone/drone-runner-docker:1.5.0