francodacosta/supervisord

Supervisord configuration generator

1.0.3 2013-10-22 07:06 UTC

This package is not auto-updated.

Last update: 2024-12-16 16:51:19 UTC


README

generate supervisord configuration files

<<?php

require __DIR__ . '/../../vendor/autoload.php';

use Francodacosta\Supervisord\Loader\ArrayLoader;
use Francodacosta\Supervisord\Configuration;
use Francodacosta\Supervisord\Processors\CommandConfigurationProcessor;

// setup supervisord config object, with a processor for command entries
$configuration = new Configuration;
$configuration->registerProcessor(new CommandConfigurationProcessor);

// configuration to generate
$config = array(
    'programs' => array(
        'cat command' => array('command' => 'tail -f /var/log/messages'),
        'ls command' => array('command' => 'ls -la', 'numprocs' => 3),
    )
);

// load the configuration object from the $config array
$loader = new ArrayLoader($config, $configuration);
$supervisordConfig = $loader->load();

// dump the generate configuration
echo $supervisordConfig->generate();

this generates the following configuraiton

[program:tail]
command=tail -f /var/log/messages

[program:ls]
process_name=%(program_name)s_%(process_num)02d
command=ls -la
numprocs=3