https://github.com/missinglink/supervisord
PHP frontend for Supervisord daemon manager
https://github.com/missinglink/supervisord
Last synced: about 1 year ago
JSON representation
PHP frontend for Supervisord daemon manager
- Host: GitHub
- URL: https://github.com/missinglink/supervisord
- Owner: missinglink
- Created: 2012-07-15T03:18:47.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2013-05-03T20:56:40.000Z (about 13 years ago)
- Last Synced: 2025-03-24T10:11:23.356Z (about 1 year ago)
- Language: PHP
- Size: 301 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PHP front-end for Supervisor daemon manager
========================================================================
This library provides a basic PHP interface to connect to a running Supervisor server via a TCP or UNIX socket.
Supervisor allows you to manage daemon processes, you can:
- Group Processes
- Start + Stop Processes & Process Groups
- Tail stdout and stderr
- Send stdin
- Read process logs
The PHP API matches the Supervisor XML-RPC API as closely as possible and therefore
is not the ideal PHP interface for process management.
Feel free to extend, or build higher level abstractions on top of this library.
Install
--------
```bash
sh install.sh
```
Example Usage
-------------
```php
use \Supervisord\Connection\Stream;
use \Supervisord\Connection\StreamConnection;
use \Supervisord\Connection\StreamException;
/** @see example.php */
// Connect to server
try {
$stream = new Stream( '127.0.0.1:9900' );
$connection = new StreamConnection( $stream );
}
// Connection Error
catch( StreamException $e ) {
die( "Can't connect to server at 127.0.0.1:9900\n" );
}
// Create client
$client = new Client( $connection );
// Add a group
$client->addGroup( 'log', 999 );
// Create a new process
$client->addProgramToGroup( 'log', 'syslog01', array(
'command' => 'tail -f /var/log/syslog',
'autostart' => 'false',
'autorestart' => 'true',
'startsecs' => 1,
));
// Start the process
$client->startProcess( 'log:syslog01', 'false' );
// Start the whole group
$client->startProcessGroup( 'log', 'false' );
// Output single process info
printf( "Single Process:\n%s\n", print_r( $client->getProcessInfo( 'log:syslog01' ), true ) );
// Output process stdout
printf( "StdOut:\n%s\n", print_r( $client->tailProcessStdoutLog( 'log:syslog01', 0, 1024 ), true ) );
// Output process stderr
printf( "StdErr:\n%s\n", print_r( $client->tailProcessStderrLog( 'log:syslog01', 0, 1024 ), true ) );
// Send process stdin
$client->sendProcessStdin( 'log:syslog01', 'hello world!' );
// Stop the process
$client->stopProcess( 'log:syslog01', 'false' );
// Stop the whole group
$client->stopProcessGroup( 'log', 'false' );
// Add a group
$client->removeProcessGroup( 'log' );
// Reset server
$client->reloadConfig();
```
Tests
--------
```bash
phpunit
```
Travis CI
---------
 http://travis-ci.org/#!/missinglink/supervisord

Regenerate the client library after installing RPC extensions
-------------------------------------------------------------
```bash
php reflect.php
```
License
------------------------
Released under the MIT(Poetic) Software license
This work 'as-is' we provide.
No warranty express or implied.
Therefore, no claim on us will abide.
Liability for damages denied.
Permission is granted hereby,
to copy, share, and modify.
Use as is fit,
free or for profit.
These rights, on this notice, rely.