Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux - Shell script run curl command in parallel

Tags:

People also ask

How do you run curls in parallel?

The solution to this is to use the xargs command as shown alongside the curl command. The -P flag denotes the number of requests in parallel. The section <(printf '%s\n' {1.. 10}) prints out the numbers 1 – 10 and causes the curl command to run 10 times with 5 requests running in parallel.

Can we use curl command in shell script?

The curl command transfers data to or from a network server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). It is designed to work without user interaction, so it is ideal for use in a shell script.

How do you send multiple requests in curl?

How to send HTTP headers with a Curl GET request? To make a GET request with HTTP headers, use the -H command-line option. You can pass as many HTTP headers with your Curl GET request as you like using the -H command line multiple times.


I would like to create linux shell script to run CURL command in parallel

For example: I have three command like

  1. curl -s http://localhost/process.php?id=1
  2. curl -s http://localhost/process.php?id=2
  3. curl -s http://localhost/process.php?id=3

I want to call above three command simultaneously.

Any help is appreciated.