How to use the pm2.restart 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 Zeukkari / leapgim / server / gulpfile.js View on Github external
pm2.connect(true, function() {
    pm2.restart('leapgim-server', function() {
      console.log('leapgim-server restarted');
      pm2.disconnect(function() { process.exit(0) });
    });
  });
});
github ma-zal / pm2-watchdog / class-process-watchdog.js View on Github external
return new Promise((resolve, reject) => {
                        pm2.restart(this.pm_id, (err) => {
                            if (err) {
                                console.error(`Process ${this.name} - restart failed. ${err.message || err}`);
                                reject(err);
                                return;
                            }
                            this.failsCountInRow = 0;
                            resolve();
                        });
                    });
github gxchain / gxb-box / server / services / BoxService.js View on Github external
pm2.connect(function (err) {
            if (err) {
                reject(err);
                process.exit(2);
            }
            pm2.restart('gxb-box-pm2', function (err) {
                if (err) {
                    reject(err);
                } else {
                    pm2.describe('gxb-box-pm2', function (err, processDescription) {
                        if (err) {
                            reject(err);
                        } else {
                            resolve(processDescription);
                        }
                    });
                }
            });
        });
    });
github polonel / trudesk / src / controllers / install.js View on Github external
pm2.connect(function (err) {
    if (err) {
      winston.error(err)
      res.status(400).send(err)
      return
    }
    pm2.restart('trudesk', function (err) {
      if (err) {
        res.status(400).send(err)
        return winston.error(err)
      }

      pm2.disconnect()
      res.send()
    })
  })
}
github LiskHQ / lisk-sdk / commander / src / utils / core / pm2.ts View on Github external
new Promise((resolve, reject) => {
		restart(process, err => {
			if (err && err.message !== 'process name not found') {
				reject(err.message);

				return;
			}
			resolve();
		});
	});
github hubot-js / hubot.js / src / cli / cli.js View on Github external
function restart() {
  pm2.restart('hubot', () => pm2.disconnect());
}
github richardwillars / thinglator / management.js View on Github external
new Promise((resolve, reject) => {
    pm2.restart(packageId, (err, apps) => {
      if (err) {
        reject(err);
        return;
      }
      resolve(apps);
    });
  });
github schahriar / Galleon / bin / tasks / process.js View on Github external
pm2.connect(function (error) {
      if (error) throw error;
      pm2.restart('galleon-instance' || argv._[1], success("GALLEON RESTARTED SUCCESSFULLY!"));
    });
  },
github polonel / trudesk / src / controllers / api / v1 / plugins.js View on Github external
pm2.connect(function(err) {
        if (err) 
            winston.error(err);
        
        pm2.restart('trudesk', function(err) {
            if (err) 
                return winston.error(err);
            

            pm2.disconnect();
        });
    });
}