計劃任務定時檢測程序是否存在,不存在則啟動
阿新 • • 發佈:2021-01-13
技術標籤:PHP
$cmd = "ps axu| egrep '(think testB)'|grep -v 'grep'|wc -l";
$ret = shell_exec("$cmd");
echo $ret;
$ret = rtrim($ret, "\r\n");
if($ret === "0") {
$start_master_cmd = "nohup /home/pubsrv/php-7.2.27/bin/php think testB >> /tmp/uctWorker.log 2>&1 &" ;
$ret = shell_exec("$start_master_cmd");
}
參考:https://www.cnblogs.com/dongruiha/p/6397170.html