How to use the pm2.flush 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 adobe / athena / athena.js View on Github external
}, function(error, res) {
          if (error) {
            throw error;
          }

          pm2.flush(APP_NAME, (err) => {
            if (err) {
              throw err;
            }
          });

          pm2.describe(0, (err, proc) => {
            const logFile = proc[0].pm2_env.pm_out_log_path;

            if (fs.existsSync(logFile)) {
              fs.unlinkSync(logFile);
            }

            setTimeout(() => {
              if (fs.existsSync(logFile)) {
                log.info(fs.readFileSync(logFile, 'UTF-8'));
              }
github Nubuck / z1-app-starter / server / src / features / service-cmd / parts / cmd / pm2.js View on Github external
return new Promise((resolve, reject) => {
    pm2.flush(procNameOrId, (err, processDescription) => {
      if (err) {
        disconnect()
        reject(err)
      } else {
        disconnect()
        resolve(processDescription)
      }
    })
  })
}