首页 > Web开发 > 详细

php判断进程是否存在

时间:2017-02-14 15:01:30      阅读:408      评论:0      收藏:0      [点我收藏+]
    //计划任务定时检测master进程是否存在,不存在则启动,以root用户运行
    public function checkMaster()
    {
        $cmd = ‘ps axu|grep "UctDataWorker masterRun"|grep -v "grep"|wc -l‘;
        $ret = shell_exec("$cmd");

        $ret = rtrim($ret, "\r\n");

        if($ret === "0") {
            $path = dirname(__FILE__) . ‘/index.php‘;
            $php_path = Config::$php_path;
            $start_master_cmd = "nohup ".$php_path." ".$path." UctDataWorker masterRun >> /data/log/uctWorker.log 2>&1 &";
            $ret = shell_exec("$start_master_cmd");
        }
    }

 

php判断进程是否存在

原文:http://www.cnblogs.com/dongruiha/p/6397170.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!