How to use the pm2.delete 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 TrueCar / gluestick / packages / gluestick / src / commands / start-server.js View on Github external
checkIfPM2ProcessExists(name, (exists) => {
      if (exists) {
        // TODO: Replace logger.
        // logger.debug(`Deleting process ${name}`);
        pm2.delete(name, () => {
          pm2.disconnect(() => {
            process.exit();
          });
        });
      } else {
        // TODO: Replace logger.
        // logger.warn(`No process with name ${name} exists`);
        pm2.disconnect(() => {
          process.exit();
        });
      }
    });
  });
github mockstarjs / mockstar / packages / mockstar-cli / biz / local-server / run-by-pm2.js View on Github external
pm2.describe(name, function (err, apps) {
            if (err) {
                pm2.disconnect();   // Disconnects from PM2
                throw err;
            }

            // 如果已存在,则先删除再启动
            if (apps.length && apps[0].name === name) {
                // 删除
                pm2.delete(name, function (err, apps) {
                    if (err) {
                        pm2.disconnect();   // Disconnects from PM2
                        throw err;
                    }

                    // 启动
                    pm2.start(pm2ConfigFilePath, function (err, apps) {
                        console.log('Start local server success!');
                        pm2.disconnect();   // Disconnects from PM2

                        if (err) {
                            throw err;
                        }
                    });
                });
            } else {
github yasaricli / pmteor / imports / api / applications / server / hooks.js View on Github external
pm2.connect((connect_err) => {
    pm2.delete(doc.bundleId, (delete_err) => {

      // CD BUNDLES DIR
      cd(BUNDLE_DIR);

      // REMOVE APPLICATON DIR AND BUNDLE FILE
      rm('-rf', [

        // DIR
        doc.bundleId,

        // TAR.GZ
        `${doc.bundleId}.tar.gz`
      ]);

      // DISCONNECT
      pm2.disconnect();
github svhawks / g3l / pm2-rm.js View on Github external
#!/usr/bin/env node
var globalModulesDir = require('global-modules');
var pm2 = require('pm2');
pm2.delete('0', function(err) {})
pm2.disconnect();
process.exit();
github TrueCar / gluestick / packages / gluestick / src / commands / start-server / runWithPM2.js View on Github external
checkIfPM2ProcessExists(name, exists => {
      if (exists) {
        logger.info(`Deleting process ${name}.`);
        pm2.delete(name, deleteError => {
          if (deleteError) {
            logger.error(deleteError);
            pm2.disconnect();
            process.exit(1);
          }
          pm2.disconnect();
          process.exit(0);
        });
      } else {
        logger.warn(`No process with name ${name} exists.`);
        pm2.disconnect();
        process.exit(0);
      }
    });
  });
github jeffallen6767 / chain / src / miner.js View on Github external
allMiners.forEach(function(miner, idx) {
          var
            id = miner.slave_index;
          pm2.delete(id, function() {
            console.log("pm2.delete", id, [].slice.call(arguments));
            if (--numMiners === 0) {
              allMiners = [];
              finished();
            }
          });
        });
      } else {
github gxchain / gxb-box / server / services / BoxService.js View on Github external
pm2.describe('gxb-box-pm2', function (err, processDescription) {
                if (err) {
                    reject(err);
                } else {
                    if (processDescription.length === 0) {
                        resolve();
                    } else {
                        pm2.delete('gxb-box-pm2', function (err) {
                            if (err) {
                                reject(err);
                            } else {
                                resolve();
                            }
                        });
                    }
                }
            });
        });
github EOSIO / eosio-explorer / pm2.js View on Github external
list.forEach((app) =>{
    pm2.delete(app.pm2_env.pm_id, (err, res)=> {
      delete_count++;
      if(delete_count === list.length){
        startPm2();
      }
    });
  });
}
github LiskHQ / lisk-sdk / commander / src / utils / core / pm2.ts View on Github external
new Promise((resolve, reject) => {
		del(process, err => {
			if (err) {
				reject(err);

				return;
			}
			resolve();

			return;
		});
	});
github deanshub / web-pm2 / common / pm2wrapper.js View on Github external
pm2.connect(true,(err)=>{
        if(err) return reject(err);
        pm2.delete(id, (err, details)=>{
          pm2.disconnect();
          if(err){
            return reject(err);
          }
          return resolve(details);
        });
      });
    });