2
我在一分鐘內使用命令行在我的服務器上運行了多次PHP腳本。但我想爲它增加一些最大值。php命令行最大進程
此腳本不一定每次運行10次以上的PHP程序。
#1 php -r myhardandlongprocess.php
#2 php -r myhardandlongprocess.php
..
#10 php -r myhardandlongprocess.php
這是什麼標準方法?
我在一分鐘內使用命令行在我的服務器上運行了多次PHP腳本。但我想爲它增加一些最大值。php命令行最大進程
此腳本不一定每次運行10次以上的PHP程序。
#1 php -r myhardandlongprocess.php
#2 php -r myhardandlongprocess.php
..
#10 php -r myhardandlongprocess.php
這是什麼標準方法?
你可以使用exec()
命令做到這一點:
$output;
$return;
exec('ps |grep ' . __FILE__ . ' |wc -l', $output, $return);
echo ((int) trim($output[0])) - 1;
編輯:改爲exec()
因爲system()
直接輸出的一切。
@fdomig:http://meta.stackexchange.com/questions/110644/comment-regarding-accept-rate-removed – Jocelyn 2012-08-01 10:55:14
@Jocelyn哦,不知道。謝了哥們。 – fdomig 2012-08-01 10:57:51