How to use the pm2.killDaemon 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 jeffallen6767 / chain / cli.js View on Github external
pm2.disconnect(function() {
    console.log("disconnected....");
    // kill the master controller and all slave miners
    pm2.killDaemon(function() {
      console.log("daemon killed....");
      process.exit(0);
    });
    // return control to the caller
    console.log("server shutdown...");
  });
} else {
github jeffallen6767 / chain / src / cuda.js View on Github external
pm2.disconnect(function() {
      // kill the master controller and all slave miners
      pm2.killDaemon(function() {
        // forget our previous slaves:
        //allMiners = [];
        // return control to the caller
        callback();
      });
    });
  },
github jeffallen6767 / chain / src / miner.js View on Github external
setTimeout(function() {
                pm2.killDaemon(function() {
                  // noop
                });
              }, 1000);
            }
github Alethio / ethstats-cli / lib / app-daemon.js View on Github external
console.log(`Name: ${app.name}`);
        console.log(`PID: ${app.pid}`);
        console.log(`Status: ${app.pm2_env.status}`);
        console.log(`Uptime: ${uptime}`);
        console.log(`Autorestart: ${app.pm2_env.autorestart}`);
        console.log(`Restart times: ${app.pm2_env.restart_time}`);
        console.log(`Instances: ${app.pm2_env.instances}`);
        console.log(`CPU usage: ${app.monit.cpu}`);
        console.log(`MEM usage: ${app.monit.memory}`);
      });
      pm2.disconnect();
    });
  }

  if (daemonOption === 'kill') {
    pm2.killDaemon(error => {
      console.log(`Ethstats daemon KILL ${(error) ? chalk.red(`[FAILED] ${error.message}`) : chalk.green('[OK]')}`);
      pm2.disconnect();
      process.exit((error) ? 1 : 0);
    });
  }
});
github Nubuck / z1-app-starter / server / src / features / service-cmd / parts / cmd / pm2.js View on Github external
return new Promise((resolve, reject) => {
    pm2.killDaemon(err => {
      if (err) {
        reject(err)
      } else {
        resolve(true)
      }
    })
  })
}
github deanshub / web-pm2 / common / pm2wrapper.js View on Github external
pm2.connect(true,(err)=>{
        if(err) return reject(err);
        pm2.killDaemon((err,details)=>{
          if(err){
            return reject(err);
          }
          return resolve(details);
        });
      });
    });
github taurusai / kungfu / app / shared / utils / processUtils.ts View on Github external
pm2Connect().then(() => {
            try{
                pm2.killDaemon((err: Error): void => {
                    pm2.disconnect()
                    if(err) {
                        logger.error(err)
                        reject(err)
                        return
                    }
                    resolve(true)
                })
            }catch(err){
                pm2.disconnect()
                logger.error(err)
                reject(err)
            }
        }).catch(err => reject(err))
    })