How to use the pm2.stop function in pm2

To help you get started, we’ve selected a few pm2 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 ArkEcosystem / core / commander / utils.js View on Github external
pm2.connect((error) => {
    if (error) {
      console.log(chalk.bgRed(error.message))
      process.exit(2)
    }

    pm2.stop(pid, (error, apps) => {
      pm2.disconnect()

      if (error) {
        console.log(chalk.bgRed(error.message))
        process.exit(2)
      }

      this.getProcessStatus(() => {
        if (callback instanceof Function) callback()
      })
    })
  })
}
github gxchain / gxb-box / server / services / BoxService.js View on Github external
pm2.connect(function (err) {
            if (err) {
                reject(err);
                process.exit(2);
            }
            pm2.stop('gxb-box-pm2', function (err) {
                if (err) {
                    reject(err);
                } else {
                    pm2.describe('gxb-box-pm2', function (err, processDescription) {
                        if (err) {
                            reject(err);
                        } else {
                            resolve(processDescription);
                        }
                    });
                }
            });
        });
    });
github 1956-studio / wechat-ship / client / controllers / server.js View on Github external
server.stop = function(name, cb) {
	pm2.stop(name, function (err, list) {
		if(err) {
			log.applog('error', 'pm2 List faild: ' + err);
		}
		return cb(err);
	});
}
github yasaricli / pmteor / imports / startup / server / polling.js View on Github external
       _.forEach(_ids, (_id) => pm2.stop(_id, () => {

       }));
     });
github mozilla / voice-web / gulpfile.js View on Github external
}, () => {
      pm2.stop(APP_NAME, f.waitPlain());
    }, () => {
      pm2.start({
github scriptify / mrnote / start-api-server.js View on Github external
pm2.list((err, list) => {

    onError(err);
    const pList = list.filter(p => p.name === scriptName);

    if(pList.length > 0) {

      if(pList[0].pm2_env.status === 'online') {

        pm2.stop(scriptName, err => {
          onError(err);
          pm2.start(scriptName, err => {
            onError(err);
            pm2.disconnect();
          });
        });
      } else {

        pm2.start(scriptName, err => {
          onError(err);
          pm2.disconnect();
        });
      }
github hubot-js / hubot.js / src / cli / cli.js View on Github external
function stop() {
  pm2.stop('hubot', () => pm2.disconnect());
}
github LiskHQ / lisk-sdk / commander / src / utils / node / pm2.ts View on Github external
new Promise((resolve, reject) => {
		stop(process, err => {
			if (err && err.message !== 'process name not found') {
				reject();

				return;
			}
			resolve();
		});
	});
github tes / bosco / src / RunWrappers / Node.js View on Github external
Runner.prototype.stop = function (options, next) {
  var self = this;
  self.bosco.log('Stopping ' + options.name.cyan);
  pm2.stop(options.name, function (err) {
    if (err) return next(err);
    pm2.delete(options.name, function (err) {
      next(err);
    });
  });
};
github hubot-js / hubot.js / src / cli / init-core.js View on Github external
dialog.err(err, 'Error', () => {
    pm2.stop('hubot', () => pm2.disconnect());
  });
}