How to use the pm2.reload 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 adonisjs / adonis-commands / src / Server / Reload.js View on Github external
pm2.connect(function () {
      pm2.reload(processName, function (err, apps) {
        if (err) {
          /**
           * show error if there is an error
           */
          self.ansi.error(err.msg)
        } else {
          /**
           * otherwise say process has been stopped
           */
          console.log(`Reloaded process ${processName} successfully`, self.ansi.icon('success'))
        }
        pm2.disconnect()

      })
    })
github 1956-studio / wechat-ship / client / controllers / server.js View on Github external
server.restart = function (name, cb) {
	pm2.reload(name, function () {
		if(err) {
			log.applog('error', 'pm2 List faild: ' + err);
		}
		return cb(err);
	});
}
github Nubuck / z1-app-starter / server / src / features / service-cmd / parts / cmd / pm2.js View on Github external
return new Promise((resolve, reject) => {
    pm2.reload(procNameOrId, (err, proc) => {
      if (err) {
        disconnect()
        reject(err)
      } else {
        disconnect()
        describeMachine(procNameOrId)
          .then(proc => {
            resolve(proc)
          })
          .catch(e => {
            reject(e)
          })
      }
    })
  })
}