How to use the forever.start 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 azer / lowkick / test / server.js View on Github external
report.reset(function(error){

    if(error){
      logging.error('Failed to reset report document.');
      logging.error(error);

      return;
    }
  
    serverProcess = forever.start(['./bin/lowkick', 'publish', 'test/tmp-config.json'], {
      silent: true
    });

    serverProcess.on('start', function(process, data){

      var url = 'http://' + configdoc.server.host + ':' + configdoc.server.port,
          startTS = +(new Date);

      (function waitServerToStart(){
        
        request.get(url, function(error){

          if(error && +(new Date)-startTS
github geekuillaume / ChatUp / entrypoint.js View on Github external
forever.stopAll();
    process.exit(1);
  });

  if (process.argv[3] === "--use-container-ip") {
    require('dns').lookup(require('os').hostname(), function (err, addr, fam) {
      forever.start('examples/chatWorker/index.js', {
        silent: false,
        max: 1,
        env: {
          CHATUP_HOSTNAME: addr
        }
      });
    })
  } else {
    var workerDaemon = forever.start('examples/chatWorker/index.js', {
      silent: false,
      max: 1
    });
  }

  process.on('exit', function() {
    forever.stopAll();
  });

} else {
  console.error('First arg should be "dispatcher" or "worker"');
  console.error("Got:", process.argv);
  process.exit(1);
}
github geekuillaume / ChatUp / entrypoint.js View on Github external
#!/bin/sh
':' //; exec "$(command -v nodejs || command -v node)" "$0" "$@"

var forever = require('forever');

if (process.argv[2] === "dispatcher") {
  forever.start('examples/dispatcher/index.js', {
    max: 1
  });
} else if (process.argv[2] === "worker") {
  var nginxDaemon = forever.start("-c/home/chatup/examples/chatWorker/nginx.conf", {
    command: "/usr/local/nginx/sbin/nginx",
    max: 1,
    silent: false,
    logFile: 'nginx.log'
  });
  nginxDaemon.on('exit', function() {
    forever.stopAll();
    process.exit(1);
  });

  if (process.argv[3] === "--use-container-ip") {
    require('dns').lookup(require('os').hostname(), function (err, addr, fam) {
      forever.start('examples/chatWorker/index.js', {
        silent: false,
        max: 1,
        env: {
github geekuillaume / ChatUp / entrypoint.js View on Github external
#!/bin/sh
':' //; exec "$(command -v nodejs || command -v node)" "$0" "$@"

var forever = require('forever');

if (process.argv[2] === "dispatcher") {
  forever.start('examples/dispatcher/index.js', {
    max: 1
  });
} else if (process.argv[2] === "worker") {
  var nginxDaemon = forever.start("-c/home/chatup/examples/chatWorker/nginx.conf", {
    command: "/usr/local/nginx/sbin/nginx",
    max: 1,
    silent: false,
    logFile: 'nginx.log'
  });
  nginxDaemon.on('exit', function() {
    forever.stopAll();
    process.exit(1);
  });

  if (process.argv[3] === "--use-container-ip") {
    require('dns').lookup(require('os').hostname(), function (err, addr, fam) {
github zenirc / zenircbot / services / admin.js View on Github external
function start_service(service) {
    if (services[service]) {
        if (services[service].running) {
            zen.send_admin_message(service + ' is already running');
        } else {
            zen.send_admin_message('starting ' + service);
            services[service].start();
        }
    } else {
        zen.send_admin_message('starting ' + service);
        child = forever.start([language_map[service.split('.')[1]], service], {
            max: 10000,
            silent: false
        });
        forever.startServer(child);
        services[service] = child;
        forever.cli.list();
    }
}
github musiqpad / mqp-server / server-package.js View on Github external
this.start = function() {
    if(this.settings.config) {
      fs.writeFileSync('./config.hjson', this.settings.config, 'utf8');
    }
		if (this.settings.forever.enabled) {
			forever.load(this.settings.forever.options);
			that.pid = forever.start('./start.js');
		}
		else {
			that.proc = runScript('./start.js', function (err) {
				if (err) throw err;
			});
		}
	};
github xiaojue / fd-server / lib / commanders.js View on Github external
exec: function() {
				forever.start(masterScript, foreverOptions).on('start', function() {
					logger.warn('fds start successed , you can use startDeamon to start with daemon , not supported windows');
				});
			}
		},
github ltackett / musictocodeto / forever.js View on Github external
var forever = require('forever');
var child = forever.start([ 'socketstream', 'start' ], {
  max : 1,
  silent : true
});

forever.startServer(child);
github bcongdon / github-label-notify / glnotify-run.js View on Github external
var path = require('path')
var forever = require('forever')

forever.start(path.join(__dirname, 'run.js'), {'uid': 'glnotify'})

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