#!/usr/bin/env bash
max=$1
shift
for i in $(seq $max); do
    if $@; then
        break
    else
        echo Command failed $? $@ >&2
        echo Retrying in 1 second $i of $max >&2
        sleep 1
        false
    fi
done
