我在一台服务器上监视两个进程。当他们中的一个死了,我要知道是哪个。
有没有比我目前所拥有的更好的方法来检查这个?到目前为止,有没有办法在没有if / elseif if的情况下做到这一点?
while ((ps proc1 -ov websrv).Responding -and (ps proc2 -ov connec).Responding)
{ sleep -m 100 }
$pmsname = if (!$websrv.Responding -and !$connec.Responding) { "beide" }
elseif (!$websrv.Responding -and $connec.Responding) { "websrv" }
elseif ($websrv.Responding -and !$connec.Responding) { "connec" }
转载请注明出处:http://www.shenzhenzsmy.com/article/20230520/2614441.html