ofbeaton/command-running
最新稳定版本:1.0.0
Composer 安装命令:
composer require ofbeaton/command-running
包简介
Detects if a command or process is currently running.
README 文档
README
Detects if a command or process is currently running and optionally kill it.
Currently supports:
- Linux
- Windows
Please note that getPids() on windows is slow (2 seconds). There may be a way to speed it up using WMI in the future.
Alternatives
If you don't need advanced features, you can use the Symfony Lock component and trait in any application, even non-symfony ones. It is actively maintained and is likely more up to date.
It supports filesystem (FlockStore), shared memory (SemaphoreStore) and even databases and Redis servers.
It does not support force claims, kills, or reports.
Updates
The project is considered in a usable state and feature complete.
This project is used in corporate applications. As such, the authors are unlikely to update it on a regular basis, but instead when the corporate applications that use it run into problems. You should expect updates in the 5-10yr range.
Issues and PRs will be monitored, and we will continue to work with the community to provide updates as they are contributed.
Installing via Composer
The recommended way to install Command Running is through Composer.
# Install Composer curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version:
composer.phar require ofbeaton/command-running
After installing, you can now use it in your code:
$pidfile = 'mypidfile.txt'; $running = new \Ofbeaton\Command\Running($pidfile); $ok = $running->claimPidFile(); if ($ok === false) { echo 'We are currently already running'.PHP_EOL; exit; } // your code // at the end of your program $running->releasePidFile();
For more detailed usage, see the Forever Example.
License
This software is distributed under the MIT License. Please see License file for more information.
统计信息
- 总下载量: 207
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-12