承接 denismilovanov/laravel-single-instance-command 相关项目开发

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

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

denismilovanov/laravel-single-instance-command

最新稳定版本:0.3

Composer 安装命令:

composer require denismilovanov/laravel-single-instance-command

包简介

README 文档

README

This package allows you to save and control pids of your artisan commands in order to organize multiprocessing, support lengthy calculations, prevent more than one process run simultaneously, etc.

I use this package only for backward compability.

Installation

composer require 'denismilovanov/laravel-single-instance-command: 0.1.*@dev'

Usage

In artisan:

$app->register('LaravelSingleInstanceCommand\ServiceProvider');

In command:

use \Symfony\Component\Console\Input\InputInterface;
use \Symfony\Component\Console\Output\OutputInterface;

class MyCommand extends \LaravelSingleInstanceCommand\Command
{
    public $name = 'my-command';
     
    public function run(InputInterface $input, OutputInterface $output)
    {
        $this->checkInstance($input);
        
        // long living code here:
        // Queue::subscribe('queue', function ($job) {
        //
        // });
    }
}

In shell (or crontab):

  • to start process php artisan my-command,

  • to start another process php artisan my-command p=2,

  • to stop process php artisan my-command p=2 stop,

  • to stop all php artisan pids:stop-all,

  • to remove stale pids files php artisan pids:remove.

Notes

Pids are save to /tmp/{APP_ENV}/ directory.
Stopping process is performed by sending SIGTERM to it.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-05