php

PHP监控一个进程是否在运行的方法

dafenqi
2023-08-12 / 0 评论 / 18 阅读 / 正在检测是否收录...

PHP监控一个进程是否在运行的方法

exec("pgrep lighttpd", $pids);
if(empty($pids)) {
    // lighttpd is not running!
}
pgrep -f  全名匹配.

 

$mabbitmq=shell_exec("pgrep [r]abbitmq"); //https://stackoverflow.com/questions/51551908/why-is-the-result-equal-to-0-and-sometimes-1-shell-execpgrep-f
$mabbitmq = str_replace(PHP_EOL, '', $mabbitmq);
$mongodb=shell_exec("pgrep [m]ongo");
$mongodb = str_replace(PHP_EOL, '', $mongodb);
$ydmcuclient=shell_exec("pgrep -f [y]dmcu_client");
$ydmcuclient = str_replace(PHP_EOL, '', $ydmcuclient);
0

Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /www/wwwroot/testblog.58heshihu.com/var/Widget/Archive.php on line 1032

评论 (0)

取消