定制 meisendev/laravel-daemon 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

meisendev/laravel-daemon

Composer 安装命令:

composer require meisendev/laravel-daemon

包简介

Runs as sentinel for a list of daemon commands

README 文档

README

Runs as sentinel for a list of daemon commands

In practice, a project can have a number of commands to be executed in a pre-determined schedule. Some commands need to be executed at a given interval, some need to run more than one instance in parallel, some need to automatically send alert when execution fails, and so on. This library provides a very useful feature called the Daemon Sentinel just to solve this problem.

This library based on oasis/slimapp and custom-made for laravel framework.

Quick Start

In your laravel project:

composer require meisendev/laravel-daemon

Add sentinel command to App\Console\Kernel like this:

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        TestDaemon1::class,
        \Meisendev\LaravelDaemon\DaemonSentinelCommand::class,
    ];
}

Add config file(e.g. meisendev.php) to config folder.

meisendev.php setup like this:

<?php

return [
    'test:daemon:1' => [
        'name' => 'test:daemon:1',//regular Artisan command signature, note: the name without args
        'once' => false,//run only once? if not, command will restart upon previous execution ends
        'parallel' => 5,//how many parallel
        'args' => [//regular Artisan command args like: 'test:daemon:1 {arg1} {arg2}'
            'arg1' => 'test1',
            'arg2' => 'test11'
        ],
        'interval' => 3,//minimum number of seconds between last end and next start
        'alert' => true
    ],
    'test:daemon:2' => [
        'name' => 'test:daemon:2',
        'once' => true,
        'parallel' => 8,
        'args' => [
            'arg1' => 'test2'
        ],
        'frequency' => '3',//minimum seconds between two start
        'alert' => true
    ]
];

Run sentinel command like this:

php artisan sentinel:run meisendev

meisendev is the config file name

Note: You'd better run above command with screen!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固