How to use the stop function from pm2

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

67
68
69
70
71
72
73
74
75
76
.command('stop')
.description('Stop Raneto Service')
.action(() => {
  pm2.connect(() => {
    // (error, proc)
    pm2.stop('raneto', (error) => {
      if (error) {
        console.log(`Raneto could not be stopped: ${error.msg}`);
        process.exit(1);
      }
fork icon449
star icon0
watch icon0

3
4
5
6
7
8
9
10
11
12
if (err) {
  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