MCPcopy
hub / github.com/Unitech/pm2 / reload

Method reload

lib/API.js:438–478  ·  view source on GitHub ↗

* Reload an application * * @param {String} process_name Application Name or All * @param {Object} opts Options * @param {Function} cb Callback

(process_name, opts, cb)

Source from the content-addressed store, hash-verified

436 * @param {Function} cb Callback
437 */
438 reload (process_name, opts, cb) {
439 var that = this;
440
441 if (typeof(opts) == "function") {
442 cb = opts;
443 opts = {};
444 }
445
446 var delay = Common.lockReload();
447 if (delay > 0 && opts.force != true) {
448 Common.printError(conf.PREFIX_MSG_ERR + 'Reload already in progress, please try again in ' + Math.floor((conf.RELOAD_LOCK_TIMEOUT - delay) / 1000) + ' seconds or use --force');
449 return cb ? cb(new Error('Reload in progress')) : that.exitCli(conf.ERROR_EXIT);
450 }
451
452 if (Common.isConfigFile(process_name))
453 that._startJson(process_name, opts, 'reloadProcessId', function(err, apps) {
454 Common.unlockReload();
455 if (err)
456 return cb ? cb(err) : that.exitCli(conf.ERROR_EXIT);
457 return cb ? cb(null, apps) : that.exitCli(conf.SUCCESS_EXIT);
458 });
459 else {
460 if (opts && opts.env) {
461 var err = 'Using --env [env] without passing the ecosystem.config.js does not work'
462 Common.err(err);
463 Common.unlockReload();
464 return cb ? cb(Common.retErr(err)) : that.exitCli(conf.ERROR_EXIT);
465 }
466
467 if (opts && !opts.updateEnv)
468 Common.printOut(IMMUTABLE_MSG);
469
470 that._operate('reloadProcessId', process_name, opts, function(err, apps) {
471 Common.unlockReload();
472
473 if (err)
474 return cb ? cb(err) : that.exitCli(conf.ERROR_EXIT);
475 return cb ? cb(null, apps) : that.exitCli(conf.SUCCESS_EXIT);
476 });
477 }
478 }
479
480 /**
481 * Restart process

Callers 12

Version.jsFile · 0.45
link.jsFile · 0.45
helpers.jsFile · 0.45
installFunction · 0.45
CLI.jsFile · 0.45
cluster.mocha.jsFile · 0.45
programmatic.jsFile · 0.45
lazy_api.mocha.jsFile · 0.45
signals.jsFile · 0.45
graceful.mocha.jsFile · 0.45
reload_inside.jsFile · 0.45

Calls 4

cbFunction · 0.85
exitCliMethod · 0.80
_startJsonMethod · 0.80
_operateMethod · 0.80

Tested by

no test coverage detected