liip/process-manager

This package is abandoned and no longer maintained. No replacement package was suggested.

Provides a simple locking mechanism based on UNIX process id's written to a PID file.

1.0.3 2014-07-30 07:41 UTC

This package is auto-updated.

Last update: 2022-02-01 12:20:47 UTC


README

Provides a simple locking mechanism based on UNIX process id's written to a "PID file".

Build Status

http://github.com/liip/LiipProcessManager.git

Here is a simple example

<?php
use Liip\ProcessManager\ProcessManager;
use Liip\ProcessManager\PidFile;

// run a process in the back ground
$processManager = new ProcessManager();
$pid = $processManager->execProcess('sleep 10m');
$processManager->isProcessRunning($pid)
$processManager->killProcess($pid);

// to set log location instead of routing it to /dev/null by default
$processManager = new ProcessManager('/path/to/logfile');
$pid = $processManager->execProcess('sleep 10m');

// acquire a lock via a pid file
$lock = new PidFile(new ProcessManager(), '/tmp/foobar');
$lock->acquireLock();
$pid = $lock->execProcess('sleep 10m');
// set the PID which should be locked on
$lock->setPid(getmypid());
$lock->releaseLock();