スクリプトには5 つの関数がありますexec()
。関数が指定された時間内に応答しない場合は、その関数が強制終了され、次の関数の実行が開始されるように設定したいと思います。
<?php
exec("timeout 5 /usr/local/bin/wrun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat'",$uptime);
exec("timeout 5 /usr/local/bin/trun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat'",$uptime);
exec("timeout 5 /usr/local/bin/drun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat'",$uptime);
?>
このtimeout
議論は機能していません。これを修正するか、別の方法を教えてください。
答え1
あなたのexec構文は間違っています
string exec ( string $command [, array &$output [, int &$return_var ]] )
コードを書き始める前に、次のような時間制限を設定する必要があります。
<?php
set_time_limit(5);
exec(" /usr/local/bin/wrun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat'",$uptime);
?>