且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何创建一个程序的同时40实例的bash脚本?

更新时间:2023-12-05 13:25:10

您可以使用一个循环,并在后台启动过程与&安培;

You can use a loop and start the processes in the background with &:

for (( i=0; i<40; i++ )); do
   php /home/calculatedata.php &
done

如果这些进程是你已经运行PHP的唯一实例,并要杀死他们,最简单的方法是的 killall

If these processes are the only instances of PHP you have running and you want to kill them all, the easiest way is killall:

killall php