SIGN IN SIGN UP
Unitech / pm2 UNCLAIMED

Node.js Production Process Manager with a built-in Load Balancer.

43013 0 27 JavaScript
2014-09-16 11:48:02 +02:00
var pm2 = require('..');
2014-09-16 11:48:02 +02:00
pm2.connect(function() {
2014-09-16 11:48:02 +02:00
pm2.start('echo.js', function() {
2014-09-16 11:48:02 +02:00
setInterval(function() {
pm2.restart('echo', function() {
});
}, 2000);
});
});
pm2.launchBus(function(err, bus) {
console.log('connected', bus);
bus.on('log:out', function(data) {
if (data.process.name == 'echo')
console.log(arguments);
2014-09-16 11:48:02 +02:00
});
bus.on('reconnect attempt', function() {
console.log('Bus reconnecting');
});
bus.on('close', function() {
console.log('Bus closed');
});
});
/**
* Exiting
*/
//pm2.disconnectBus(); // For Bus system
//pm2.disconnect(); // For RPC connection