add timeout to curl requests
fixed saving of exit status
wait a couple of seconds before retrying to connect