Skip to content

Instantly share code, notes, and snippets.

@Unitech
Last active August 29, 2015 14:07
Show Gist options
  • Save Unitech/4a84d9b3de347cdf543d to your computer and use it in GitHub Desktop.
Save Unitech/4a84d9b3de347cdf543d to your computer and use it in GitHub Desktop.
require('pm2')()
.create({
script : '/tmp/hello.js',
instances: 'max',
}, function(err, started) {
console.log('Successfully started %s processes', started.length)
})
.list(function(process_list) {
console.log(process_list);
})
.then(function() {
this.restart('all')
});
require('pm2')()
.then(function() {
this.create({
script : '/tmp/hello.js',
instances: 'max',
})
.then(function(ret) {
console.log(ret);
return this.list();
})
.then(function(list) {
console.log(list);
return this.restart('all');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment