Linux Shell-在Centos 7中启动10000个进程,并将每个进程记录到不同的文件中

Linux Shell-在Centos 7中启动10000个进程,并将每个进程记录到不同的文件中,linux,shell,nohup,Linux,Shell,Nohup,我想启动10000个进程,每个进程都是用Clang编写的mqtt客户机代码的构建,每个进程在接收消息时都会记录到不同的文件,但当我运行这个shell脚本时,它在999处被阻止。查看原始代码v1.sh,如果我将其更改为v2.sh,它将不会被卡住。 我已经尝试过修改linux内核配置,如前所述 另外,我在/etc/security/limits.conf中添加了 * soft nproc 1048576 * hard nproc 1048576 那么,如何修改配置以使其(启动10000

我想启动10000个进程,每个进程都是用Clang编写的mqtt客户机代码的构建,每个进程在接收消息时都会记录到不同的文件,但当我运行这个shell脚本时,它在999处被阻止。查看原始代码
v1.sh
,如果我将其更改为
v2.sh
,它将不会被卡住。 我已经尝试过修改linux内核配置,如前所述

另外,我在
/etc/security/limits.conf
中添加了

 * soft nproc   1048576
 * hard nproc   1048576
那么,如何修改配置以使其(启动10000个进程,每个进程都记录到不同的文件)正常工作呢

  • v1.sh
  • v2.sh

在进行ulimit更改后是否重新启动了shell?@RamanSailopal当然,我重新启动了。
#!/bin/sh
a=1
start_topic=1
echo "$1"
while [ $a -le "$1" ]; do
  ((Num = $a % 1000))
  if [ $Num == 0 ]; then
    ((start_topic++))
  else
    command="nohup ./stdoutsub channel_$start_topic  --host example_host --port 1883 --username example_username --password example_password --clientid test_3.3_$a >nohup.out &"
    eval "$command"
    printf "%s start completed\n" $a
    a=$((a + 1))
    sleep 0.1
  fi
done
#!/bin/sh
a=1
start_topic=1
echo "$1"
while [ $a -le "$1" ]; do
  ((Num = $a % 1000))
  if [ $Num == 0 ]; then
    ((start_topic++))
  else
    command="nohup ./stdoutsub channel_$start_topic  --host example_host --port 1883 --username example_username --password example_password --clientid test_3.3_$a >nohup_$a.out &"
    eval "$command"
    printf "%s start completed\n" $a
    a=$((a + 1))
    sleep 0.1
  fi
done