Run curl until success