PHP Class Cml\Tools\Daemon\ProcessManage

Mostrar archivo Open project: linhecheng/cmlphp Class Usage Examples

Public Methods

Method Description
addTask ( string $task, integer $frequency = 60 ) : void 添加任务
getStatus ( boolean $showInfo = false ) : array 检查脚本运气状态
getStatus ( boolean $showInfo = false ) : array | void 检查脚本运气状态
reload ( ) reload服务
rmTask ( string $task ) : void 删除任务
run ( string $cmd ) shell参数处理并启动守护进程
start ( ) 开始运行
stop ( ) 终止后台进程

Protected Methods

Method Description
createChildrenProcess ( ) 创建一个子进程
setProcessName ( $title ) 设置进程名称

Private Methods

Method Description
checkExtension ( ) 检查是否安装了相关扩展
demonize ( ) 初始化守护进程
getPid ( ) : integer 获取进程id
initEvn ( ) 初始化环境
message ( string $message = '' ) 向shell输出一条消息
setUser ( string $name ) : boolean 设置运行的用户
signReload ( ) reload
signStop ( ) stop
signalHandler ( integer $sigNo ) 信号处理

Method Details

addTask() public static method

添加任务
public static addTask ( string $task, integer $frequency = 60 ) : void
$task string 任务的类名带命名空间
$frequency integer 执行的频率
return void

createChildrenProcess() protected static method

创建一个子进程
protected static createChildrenProcess ( )

getStatus() public static method

检查脚本运气状态
public static getStatus ( boolean $showInfo = false ) : array
$showInfo boolean 是否直接显示状态
return array

getStatus() public static method

检查脚本运气状态
public static getStatus ( boolean $showInfo = false ) : array | void
$showInfo boolean 是否直接显示状态
return array | void

reload() public static method

reload服务
public static reload ( )

rmTask() public static method

删除任务
public static rmTask ( string $task ) : void
$task string 任务的类名带命名空间
return void

run() public static method

shell参数处理并启动守护进程
public static run ( string $cmd )
$cmd string

setProcessName() protected static method

设置进程名称
protected static setProcessName ( $title )
$title

start() public static method

开始运行
public static start ( )

stop() public static method

终止后台进程
public static stop ( )