承接 graftype/nohup 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

graftype/nohup

最新稳定版本:1.0.13

Composer 安装命令:

composer require graftype/nohup

包简介

A library to run a command in the background, it will return the process's pid, and get it's is running status anytime in the another process, and can be stoped anytime.

README 文档

README

A library to run a command in the background, it will return the process's pid, and get it's is running status anytime in the another process, and can be stoped anytime.

Navigation

Installation

Using composer:

composer require graftype/nohup

Usage

Run a script in background

use graftype\nohup;

$process = Nohup::run('sleep 5');

It will be running in the background for 5 seconds.

But, it can be stoped any time:

//...
$process->stop();

It stoped now!

Get the pid : $process->getPid(), it will return the real pid in both window and *inx system.

Get it's running status with the function $process->isRunning():

use graftype\nohup\Nohup;

$process = Nohup::run('sleep 5');
while ($process->isRunning()) {
    echo '.';
    sleep(1);
}
echo "Done.\n";

output: .....Done.

Create process from known pid ($pid)

use graftype\nohup\Process;

$process = Process::loadFromPid($pid);  
// or
$process = new Process($pid); 

if ($process->isRunning()) {
    $process->stop();
}

Method:

Nohup::run($commandLine, $outputFile, $errorFile)

  • $commandLine: string, the command will be run.
  • $outputFile: string, the file path where to save output content.
  • $errlogFile: string, the file path where to save error message.

统计信息

  • 总下载量: 44
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固