lib/utils.js
function(options)
    {
        return new Promise( (resolve, reject) =>
        {
            if (options)
            {
                options.logger.info('[PROGENIC] Starting "%s" daemon with %s workers...', options.name, options.workers);
                options.logger.info('[PROGENIC] [from "%s"]', options.main);

                // Write the PID file:
                helpers.writePidFile(options.name, options.devMode, options.logger);

                cluster.setupMaster(
                {
                    exec: path.join(__dirname, 'worker.js'),
                    args: [options.main, process.env.INSTANCE_NAME],
                    silent: true
                });

                const promises = [];

                let count = options.workers;

                while (count-- > 0)
                {
                    options.logger.info('[PROGENIC] Creating  worker #%s...', (options.workers - count));

                    promises.push(helpers.forkWorker(options.name, options.devMode, options.logger, options.logsBasePath, options.checkPingsEnabled));
                }

                Promise.all(promises)
                .then(resolve)
                .catch(reject);
            }
            else
            {
                reject(new Error('Missing options'));
            }
        });
    }
function(options)
    {
        return new Promise( (resolve, reject) =>
        {
            if (options)
            {
                options.logger.info('[PROGENIC] Starting "%s" daemon with %s workers...', options.name, options.workers);
                options.logger.info('[PROGENIC] [from "%s"]', options.main);

                // Write the PID file:
                helpers.writePidFile(options.name, options.devMode, options.logger);

                cluster.setupMaster(
                {
                    exec: path.join(__dirname, 'worker.js'),
                    args: [options.main, process.env.INSTANCE_NAME],
                    silent: true
                });

                const promises = [];

                let count = options.workers;

                while (count-- > 0)
                {
                    options.logger.info('[PROGENIC] Creating  worker #%s...', (options.workers - count));

                    promises.push(helpers.forkWorker(options.name, options.devMode, options.logger, options.logsBasePath, options.checkPingsEnabled));
                }

                Promise.all(promises)
                .then(resolve)
                .catch(reject);
            }
            else
            {
                reject(new Error('Missing options'));
            }
        });
    }
function ( options ) { return new Promise ( ( resolve , reject ) => { if ( options ) { options . logger . info ( '[PROGENIC] Starting "%s" daemon with %s workers...' , options . name , options . workers ) ; options . logger . info ( '[PROGENIC] [from "%s"]' , options . main ) ; // Write the PID file: helpers . writePidFile ( options . name , options . devMode , options . logger ) ; cluster . setupMaster ( { exec : path . join ( __dirname , 'worker.js' ) , args : [ options . main , process . env . INSTANCE_NAME ] , silent : true } ) ; const promises = [ ] ; let count = options . workers ; while ( count -- > 0 ) { options . logger . info ( '[PROGENIC] Creating  worker #%s...' , ( options . workers - count ) ) ; promises . push ( helpers . forkWorker ( options . name , options . devMode , options . logger , options . logsBasePath , options . checkPingsEnabled ) ) ; } Promise . all ( promises ) . then ( resolve ) . catch ( reject ) ; } else { reject ( new Error ( 'Missing options' ) ) ; } } ) ; }
Creates the children workers when running as cluster master.
Runs the HTTP server otherwise.

@param  {Number} count Number of workers to create.
Creates the children workers when running as cluster master . Runs the HTTP server otherwise .