0
  • I'm sending a bunch of cURL requests in a consecutive order
  • It may happen that a resource will no longer be there after a while, because of which I'll get a response like the last one, marked with red. A valid, good response is marked with green: Text
  • The problem here is that the script will keep trying to finish, basically sending no longer valid requests.
  • There are other types of errors where text appears in the response (ex: Not Found), which I handle with grep to stop executing the script (creating a 24h pause to be more precise)
  • But how to solve this particular problem ? I only get the hyphens under Time Total and Time Spent, which is an indicator for me that the resource is no longer there, and no additional text is being displayed.

Thank you in advance for your suggestions and potential solutions.

Elio
  • 45
  • 7
  • Does this help? https://stackoverflow.com/questions/38906626/curl-to-return-http-status-code-along-with-the-response – Aval Sarri Sep 08 '21 at 17:19

1 Answers1

1

limit the curl command runtime using --max-time or --connect-timeout depend on your needs.

you can limit the running time of curl with timeout as well

timeout 10 curl http://....

After the curl command ends you can continue and parse the output

Oren
  • 9
  • 3