Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Curl retry mechanism

  • 18-03-2017 11:38AM
    #1
    Closed Accounts Posts: 6,075 ✭✭✭


    I have a script I run to deploy 2 web services and a front-end application. The script calls a method that checks to see if the 2 back-end services are up and running. If so, deem the deploy successful, otherwise revert.

    The 2 services sometimes take longer than the front-end to start up. Currently I put in a sleep call to delay the web service check. This allows them time to start up.

    I want to remove this sleep and add in a retry mechanism so that if a service is down, just retry the check repeatedly until I get a response.

    Tp check if the device is up, I use curl. I've read that curl has a retry mechanism but I've never used it.

    Have any of you solved this problem before? I want to understand the things I must consider when solving it, e.g. do I retry until i get a HTTP 200 from my service?

    Anyone any suggestions how I'd test this? I'd need to find a service that was down.


Comments

Advertisement