使用shell脚本快速并行启动指定数量的进程
使用shell脚本快速并行启动指定数量的进程
shell 脚本提升速度
i=0
while true;do
# 此文件里面可以放同时执行的数量
mod=$(cat process_count.plain.txt)
# 并行执行数量, 默认为3个进程执行
if [ -z "$mod" ]; then
mod=3
fi
if [ $((i % mod)) -eq "0" ]; then
echo "running $i"
# 关键在这里,需要等待上一批脚本执行完成
wait
fi
nohup sh your_script.sh >> your_script_${i}.log 2>&1 &
((i++))
done
本站总访问量次 本站访客数人次 本文总阅读量次