How to use the disconnect function from pm2

Find comprehensive JavaScript pm2.disconnect code examples handpicked from public code repositorys.

61
62
63
64
65
66
67
68
69
70
 */
function(err, apps) {

    if (err) {
        console.error(`PM2 get process list failed. ${err.message || err}`);
        pm2.disconnect();
        return;
    }

    apps.forEach((/*ProcessDescription*/ processDescription) => {
fork icon8
star icon16
watch icon0

4
5
6
7
8
9
10
11
12
13
  console.error(err);
  process.exit(2);
}

pm2.stop('index.js', function(err) {
  pm2.disconnect();   // odłączamy się od pm2, gdy już nie jest nam potrzebne połączenie
  if (err) {
    console.error(err);
    process.exit(2);
  }
fork icon0
star icon0
watch icon0