定制 andrewfenn/pid-helper 二次开发

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

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

andrewfenn/pid-helper

最新稳定版本:0.1.0

Composer 安装命令:

composer require andrewfenn/pid-helper

包简介

A small helper class used to help you check if code is still running

关键字:

README 文档

README

Software License Quality Score

Total Downloads Total Downloads Total Downloads

Just a small helper class designed to allow you to easily keep track of code that is already running so that it doesn't run twice.

Why yet another PID helper class?

I wanted a process checker that did things properly on linux. It uses the /proc interface to see if the process is still running. On OSX it uses the ps command.

There is no windows support in this library. If you'd like to add it then please submit a pull request that does something similar to the OSX or Linux implementations.

How to install

Add the following to your composer.json file and run composer update.

    "require": {
        "andrewfenn/pid-helper": "0.1.0"
    }

How to use

To use it call the code as shown below. This class will check that the process id is still running or not.

<?php
use PidHelper/PidHelper;

$pidHelper = new PidHelper('/path/to/dir/', 'process.pid');

if (!$pidHelper->lock()) {
    exit("Script Running\n");
}

// .... Your code ....

// Optional
$pidHelper->unlock();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-01