簡體   English   中英

Linux - Shell腳本並行運行curl命令

[英]Linux - Shell script run curl command in parallel

我想創建linux shell腳本來並行運行CURL命令

例如:我有三個命令

  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

我想同時調用上面三個命令。

任何幫助表示贊賞。

我認為一個bash腳本如:

#!/bin/bash

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

但是,這將作為后台進程啟動所有任務。 不知道同時啟動過程有多重要。

我想你可以在一行中的curl命令之間使用&,如下所示:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM