Cml\Tools\Daemon\ProcessManage::getStatus PHP Method

getStatus() public static method

检查脚本运气状态
public static getStatus ( boolean $showInfo = false ) : array
$showInfo boolean 是否直接显示状态
return array
    public static function getStatus($showInfo = false)
    {
        $status = is_file(self::$status) ? Cml::requireFile(self::$status) : [];
        if (!$showInfo) {
            return $status;
        }
        if (self::getPid() > 0) {
            self::message('is running');
            self::message('master pid is ' . self::getPid());
            self::message('worker pid is [' . implode($status['pid'], ',') . ']');
            self::message('task nums (' . count($status['task']) . ') list  [' . json_encode($status['task'], PHP_VERSION >= '5.4.0' ? JSON_UNESCAPED_UNICODE : 0) . ']');
        } else {
            echo 'not running' . PHP_EOL;
        }
    }

Same methods

ProcessManage::getStatus ( boolean $showInfo = false ) : array | void

Usage Example

Ejemplo n.º 1
0
 /**
  * 查看守护进程运行状态
  *
  * @param array $args 传递给命令的参数
  * @param array $options 传递给命令的选项
  *
  * @throws \InvalidArgumentException
  */
 public function execute(array $args, array $options = [])
 {
     ProcessManage::getStatus(true);
 }