How to use the forever.startDaemon function in forever

To help you get started, we’ve selected a few forever examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appnexus / sicksync / bin / remote.js View on Github external
/**
 *  Bootstrapper for remote-daemon.js
 *
 *  Triggered by first run of sicksync client, through ssh connection
 *  This file should only run on your devbox, (IE, in the data center).
 *  
 */

 console.log('starting daemon');

var forever = require('forever'),
    daemonFilePath = './sicksync-dev/lib/remote-daemon.js';

// TODO: change these files paths, right now they output to user's home location on remote server
// due to the fact that the process.cwd() is /home/cdopuch
var daemon = forever.startDaemon(
    daemonFilePath,
    {
        // NOTE: these log files are truncated on each new run
        // TODO: rotate the logs so we can save old logs
        'logFile': 'new-remote-daemon.log',
        'outFile': 'new-remote-daemon-stdout.log',
        'errFile': 'new-remote-daemon-stderr.log',
        'max': 1,
        'uid': 'remote-daemon'
    }
);
var server = forever.startServer(daemon);

// process.stdout.write('[remote.js] up and waiting');
console.log('[remote.js] up and waiting');
github soomtong / blititor / blit.js View on Github external
.action(function () {
        var script = path.join(__dirname, 'app.js');
        forever.startDaemon (script, {});

        console.log("blititor server is started...");
    });
github avikj / fbash / src / fbash-start.js View on Github external
function launch() {
  forever.startDaemon('main.js', {
    'uid': 'fbash',
    'script': 'index.js',
    'sourceDir': __dirname,
    'logFile': path.join(fbashDir, 'forever.log'),
    'outFile': path.join(fbashDir, 'out.log'),
    'errFile': path.join(fbashDir, 'err.log')
  });
  console.log('Started fbash.');
}
github lazojs / lazo / run.js View on Github external
fsx.mkdirs(lazoPath + '/logs', function (err) {
        if (!err) {
            forever.load({ root: lazoPath + '/logs', pidPath: lazoPath });
            forever.startDaemon('./lib/server/app.js', {
                logFile: 'lazo.log',
                pidFile: 'lazo.pid',
                errFile: 'lazo.err',
                sourceDir: lazoPath,
                a: true
            });
        } else {
            console.error(err);
        }
    });
}
github xiaojue / fd-server / lib / commanders.js View on Github external
function _start() {
						var child = forever.startDaemon(masterScript, foreverOptions);
						logger.info('log file ' + foreverOptions.logFile);
						logger.info('open http://local.fd.server/ to check the server!');
					}
					forever.stop(foreverOptions.uid).on('stop', _start).on('error', _start);
github uptownhr / dpanel / bin / dpanel.js View on Github external
forever.list(false, function(err, processes, a) {
        var running = false;
        if (processes) {
            running = processes.some(function(process) {
                return (process.file == '../api.js');
            });
        }

        if (!running) {
            var child = forever.startDaemon('../api.js', {
                max: 3,
                silent: true,
                options: []
            });
        }
    });
github SocketCluster / loadbalancer / bin / cli.js View on Github external
var startBalancer = function () {
  var child = forever.startDaemon(balancerFilePath, {
    uid: balancerUid,
    max: MAX_RESTARTS,
    logFile: logFileName,
    outFile: logFileName,
    errFile: logFileName,
    args: commandRawArgs
  });
  forever.startServer(child);
  successMessage('Started loadbalancer - Logging to ' + logFileName);
};
github bustardcelly / caddis / lib / caddis.js View on Github external
caddis.start = function(port, callback) {
  
  mkdirp.sync(tmp);
  
  if(fs.existsSync(caddis.outlog)) {
    fs.writeFileSync(caddis.outlog, '', 'utf8');
  }

  generateServerScript(port, caddis.original, caddis.server);

  forever.startDaemon(caddis.server, {
      logFile: caddis.outlog,
      append: false
    })
    .on('error', function(error) {
      callback(error);
    });
  checkRegistry(caddis.server, callback);

};

forever

A simple CLI tool for ensuring that a given node script runs continuously (i.e. forever)

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis