Friday, September 2, 2022

[SOLVED] Using xargs to make parallel curl API calls

Issue

When i run the following command:

seq 1 1 | xargs -I % -P 5 curl -k --user user:pass "https://localhost:port/api"

I only get one response back. I would have expected to get 5 responses since i'm running the curl command 5 times in parallel.

Is this correct or should i see 5 responses?


Solution

The problem is on your seq command the range is from 1 to 1.

Try seq 1 5 instead.



Answered By - Dean Householder
Answer Checked By - David Goodson (WPSolving Volunteer)