How to use the pm2.disconnect 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 anticoders / gagarin / packages / gagarin-core / src / equipment.js View on Github external
script           : pathToAppBundle,
            exec_interpreter : pathToNode,
          });
          break;
        default:
          console.log('unknown process type:', p.type);
        // case 'mongod':
      }
    }
  
    console.log('started all process');

  } catch (err) {
    console.log(err.stack);
  } finally {
    await asPromise(pm2.disconnect());
    console.log('disconnected from pm2');
  }
};
github phylogeny-explorer / explorer / tools / runServer.js View on Github external
pm2.start(ecosystem, function(err, proc) {
      cb(err, 'localhost:3000');
      console.log(proc);
      pm2.disconnect();   // Disconnects from PM2
      if (err) console.log(err);
    });
  });
github yasaricli / pmteor / imports / api / applications / server / helpers.js View on Github external
});

              // DISCONNECT
              pm2.disconnect();
            }));
          }

          // ERRORED LOGS INSERT
          Logs.insert({
            process: { name: self.bundleId },
            type: LOG_TYPE_MAPPER.ERRORED,
            data: start_error.msg
          });

          // IF STARTED ERROR THEN DISCONNECT
          pm2.disconnect();
        }));
      }));
github yasaricli / pmteor / imports / api / applications / server / hooks.js View on Github external
// 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 pankleks / pm2-health / Health.js View on Github external
function stopIfEx(ex) {
    if (ex) {
        Log_1.error(ex.message || ex);
        PM2.disconnect();
        process.exit(1);
    }
}
exports.stopIfEx = stopIfEx;
github Alethio / ethstats-cli / lib / app-daemon.js View on Github external
pm2.start(processOptions, error => {
      console.log(`Ethstats daemon START ${(error) ? chalk.red(`[FAILED] ${error.message}`) : chalk.green('[OK]')}`);
      pm2.disconnect();
    });
  }
github pankleks / pm2-health / Health.ts View on Github external
export function stopIfEx(ex: any) {
    if (ex) {
        error(ex.message || ex);
        PM2.disconnect();
        process.exit(1);
    }
}
github tes / bosco / src / RunWrappers / Node.js View on Github external
Runner.prototype.disconnect = function (next) {
  pm2.disconnect(next);
};