你提到的 fetchlinux 可能是指以下几种情况之一,我先按常见场景解释,并给出批量使用的方法。如果你指的是某个具体工具(比如某个内部脚本、特定发行版的 fetch 工具),可以再补充说明。
fetch(FreeBSD 的 fetch)在 Linux 上的替代Linux 上常见的是 curl / wget,但如果你在用 fetch(如 CentOS/EPEL 提供的 fetch 工具或 BusyBox fetch),批量下载通常这样做:
while read url; do
fetch "$url"
done < url_list.txt
url_list.txt 示例:
http://example.com/a.txt
http://example.com/b.txt
cat url_list.txt | xargs -n 1 -P 10 fetch
-P 10:同时运行 10 个 fetch-n 1:每次传一个 URL如果 fetchlinux 是一个自定义命令或脚本,常见批量方式:
for pkg in pkg1 pkg2 pkg3; do
fetchlinux $pkg
done
echo "pkg1 pkg2 pkg3" | xargs -n1 -P4 fetchlinux
fetchlinux $(cat pkglist.txt)
或
xargs fetchlinux < pkglist.txt
常见做法是配合 Ansible / Salt / Shell:
- hosts: all
tasks:
- name: fetch linux
command: fetchlinux {{ item }}
loop:
- node1
- node2
- node3
xargs -P 提高并发-retry 或 curl -C - 断点续传如果你能贴一下:
fetchlinux 的完整命令示例which fetchlinux 的输出我可以给你完全匹配的批量方案。