PHPackages                             tuxcoder/pid\_manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tuxcoder/pid\_manager

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tuxcoder/pid\_manager
=====================

PIDManager for PHP, stop running command twice

1291PHP

Since Jun 3Pushed 10y ago1 watchersCompare

[ Source](https://github.com/TuxCoder/PIDManagerBundle)[ Packagist](https://packagist.org/packages/tuxcoder/pid_manager)[ RSS](/packages/tuxcoder-pid-manager/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

SymfonyPIDManager
=================

[](#symfonypidmanager)

Description
-----------

[](#description)

This bundle is intended to prevent running a command twice at the same time.

When you spool your mails for an example with an cronjob and have a huge amount of mails, it could otherwise happen that the old instance is still sending emails while starting the command a second time.

\###Function The functionality is kept simple. Before executing a command this PIDManager writes the current pid (process id) into a configured file(pid\_path). Before running a second time it will check this file and return if the process is still running.

\###Warning This Bundle currently only works on Linux, because it detects running processes over the procfs (/proc/$pid).

Usage
-----

[](#usage)

\###With Symfony2

AppKernel.php add the following lines

```
new TuxCoder\PIDManagerBundle\PIDManagerBundle(),

```

config.yml add the following lines

```
pid_manager:
  commands:
    - name: swiftmailer:spool:send
      pid_path: /run/user/symfony/mail_spool.pid
    - name: secoundCommandName
      pid_path: /path/to/otherPidFile.pid

```

\###Without Symfony2 $pidManager=new \\TuxCoder\\PIDManagerBundle\\PIDManager(); $pidManager-&gt;setPidPath('/path/to/pid/file'); if(!$pidManager-&gt;isRunning()) { $pidManager-&gt;setRunning();

```
  //do some cool stuff

  $pidManager->setNotRunning();
} else {
  //error program is running
}

```

TODO
----

[](#todo)

- Write some Tests
- Add an event handler for "AllreadyRunningException".
- If requested also make it runnable on Windows, Mac, BSD....

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2470864?v=4)[TuxCoder](/maintainers/TuxCoder)[@TuxCoder](https://github.com/TuxCoder)

---

Top Contributors

[![TuxCoder](https://avatars.githubusercontent.com/u/2470864?v=4)](https://github.com/TuxCoder "TuxCoder (1 commits)")

### Embed Badge

![Health badge](/badges/tuxcoder-pid-manager/health.svg)

```
[![Health](https://phpackages.com/badges/tuxcoder-pid-manager/health.svg)](https://phpackages.com/packages/tuxcoder-pid-manager)
```

###  Alternatives

[uma/composer-psysh

No-frills PsySH-Composer plugin

183.2k](/packages/uma-composer-psysh)[antares/accessible

PHP library that allows you to define your class' getters, setters and constructor with docblock annotations.

123.9k1](/packages/antares-accessible)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
