EasyTask命令整合

简介: EasyTask命令整合

在基础入门中我们看到启动命令,但是启动后任务如何停止?如何查看状态?此处给出基础入门代码。

1.通用整合命令:

// 获取命令
$force = empty($_SERVER'argv') ? '' : $_SERVER'argv';
$command = empty($_SERVER'argv') ? '' : $_SERVER'argv';

// 配置任务
$task = new Task();
$task->setRunTimePath('./Application/Runtime/');
$task->addFunc(function () {

    $url = 'https://www.gaojiufeng.cn/?id=271';
    @file_get_contents($url);
}, 'request', 10, 2);;

// 根据命令执行
if ($command == 'start')
{

$task->start();

}
elseif ($command == 'status')
{

$task->status();

}
elseif ($command == 'stop')
{

$force = ($force == 'force'); //是否强制停止
$task->stop($force);

}
else
{

exit('Command is not exist');

}
启动任务: php console.php start
查询任务: php console.php status
普通关闭: php console.php stop
强制关闭: php console.php stop force

目录
相关文章
|
开发框架 缓存 安全
WEBjs命令
WEBjs命令
|
索引
while命令
while命令
94 0
|
Shell 数据库 数据安全/隐私保护
命令汇总
命令汇总
108 0
|
Windows
一些命令使用
版权声明:转载请注明出处:http://blog.csdn.net/dajitui2024 https://blog.csdn.net/dajitui2024/article/details/79396288 ...
1002 0
|
开发工具 Android开发 git