diff --git a/lib/API.js b/lib/API.js index fd59cd53..3da054c7 100644 --- a/lib/API.js +++ b/lib/API.js @@ -21,6 +21,7 @@ var Config = require('./tools/Config'); var Modularizer = require('./API/Modules/Modularizer.js'); var path_structure = require('../paths.js'); var UX = require('./API/CliUx'); +var pkg = require('../package.json'); var IMMUTABLE_MSG = chalk.bold.blue('Use --update-env to update environment variables'); @@ -384,18 +385,25 @@ API.prototype.update = function(cb) { // Dump PM2 processes that.Client.executeRemote('notifyKillPM2', {}, function() {}); - that.dump(function(err) { - debug('Dumping successfull', err); - that.killDaemon(function() { - debug('------------------ Everything killed', arguments); - that.Client.launchDaemon({interactor:false}, function(err, child) { - that.Client.launchRPC(function() { - that.resurrect(function() { - Common.printOut(chalk.blue.bold('>>>>>>>>>> PM2 updated')); - Modularizer.launchAll(that, function() { - KMDaemon.launchAndInteract(that._conf, null, function(err, data, interactor_proc) { - // Interactor error can be skipped here - return cb ? cb(null, {success:true}) : that.speedList(); + that.getVersion(function(err, new_version) { + if (!err && (pkg.version != new_version)) { + var dt = fs.readFileSync(path.join(__dirname, that._conf.KEYMETRICS_UPDATE)); + console.log(dt.toString()); + } + + that.dump(function(err) { + debug('Dumping successfull', err); + that.killDaemon(function() { + debug('------------------ Everything killed', arguments); + that.Client.launchDaemon({interactor:false}, function(err, child) { + that.Client.launchRPC(function() { + that.resurrect(function() { + Common.printOut(chalk.blue.bold('>>>>>>>>>> PM2 updated')); + Modularizer.launchAll(that, function() { + KMDaemon.launchAndInteract(that._conf, null, function(err, data, interactor_proc) { + // Interactor error can be skipped here + return cb ? cb(null, {success:true}) : that.speedList(); + }); }); }); }); @@ -615,29 +623,19 @@ API.prototype.killDaemon = API.prototype.kill = function(cb) { that.Client.executeRemote('notifyKillPM2', {}, function() {}); - that.getVersion(function(err, data) { - if (!err && semver.lt(data, '1.1.0')) { - // Disable action command output if upgrading from < 1.1.0 PM2 - // This is in order to avoid duplicated output - process.env.PM2_SILENT = 'true'; - console.log(conf.PREFIX_MSG + 'Killing processes...'); - } + that.killAllModules(function() { + that._operate('deleteProcessId', 'all', function(err, list) { + Common.printOut(conf.PREFIX_MSG + 'All processes have been stopped and deleted'); + process.env.PM2_SILENT = 'false'; - that.killAllModules(function() { - that._operate('deleteProcessId', 'all', function(err, list) { - Common.printOut(conf.PREFIX_MSG + 'All processes have been stopped and deleted'); - process.env.PM2_SILENT = 'false'; - - that.killInteract(function(err, data) { - that.Client.killDaemon(function(err, res) { - if (err) Common.printError(err); - Common.printOut(conf.PREFIX_MSG + 'PM2 stopped'); - return cb ? cb(err, res) : that.exitCli(conf.SUCCESS_EXIT); - }); + that.killInteract(function(err, data) { + that.Client.killDaemon(function(err, res) { + if (err) Common.printError(err); + Common.printOut(conf.PREFIX_MSG + 'PM2 stopped'); + return cb ? cb(err, res) : that.exitCli(conf.SUCCESS_EXIT); }); }); }); - }); }; diff --git a/lib/API/Keymetrics/motd b/lib/API/Keymetrics/motd index 298e7575..26b30058 100644 --- a/lib/API/Keymetrics/motd +++ b/lib/API/Keymetrics/motd @@ -5,4 +5,4 @@ /_/ |_\___/\__, /_/ /_/ /_/\___/\__/_/ /_/\___/____/ /____/ - A Node.js monitoring solution you will love + Harden your Node.js application, today diff --git a/lib/keymetrics.bkcp b/lib/keymetrics.bkcp deleted file mode 100644 index 728be8b1..00000000 --- a/lib/keymetrics.bkcp +++ /dev/null @@ -1,25 +0,0 @@ - - ------------- - - Looking for a complete monitoring and management tool for PM2? - _ _ _ _ - | | _____ _ _ _ __ ___ ___| |_ _ __(_) ___ ___ (_) ___ - | |/ / _ \ | | | '_ ` _ \ / _ \ __| '__| |/ __/ __| | |/ _ \ - | < __/ |_| | | | | | | __/ |_| | | | (__\__ \_| | (_) | - |_|\_\___|\__, |_| |_| |_|\___|\__|_| |_|\___|___(_)_|\___/ - |___/ - - Features - - - Real Time Dashboard - - CPU/Memory monitoring - - HTTP monitoring - - Event notification - - Custom value monitoring - - Real Time log display - - Checkout - - https://keymetrics.io/ - - ------------- diff --git a/lib/keymetrics b/lib/motd similarity index 88% rename from lib/keymetrics rename to lib/motd index d51934a0..e2001d75 100644 --- a/lib/keymetrics +++ b/lib/motd @@ -12,7 +12,9 @@ __/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____ _\///______________\///______________\///__\///////////////__ - Production Process Manager for Node.js apps + Community Edition + + Production Process Manager for Node.js applications with a built-in Load Balancer. @@ -29,7 +31,7 @@ __/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____ $ pm2 startup To go further checkout: - http://pm2.io + http://pm2.io/ ------------- diff --git a/lib/motd.update b/lib/motd.update new file mode 100644 index 00000000..7ea0e9b6 --- /dev/null +++ b/lib/motd.update @@ -0,0 +1,18 @@ + + ------------- + __ __ __ _ + / //_/__ __ ______ ___ ___ / /______(_)_________ + / ,< / _ \/ / / / __ `__ \/ _ \/ __/ ___/ / ___/ ___/ + / /| / __/ /_/ / / / / / / __/ /_/ / / / /__(__ ) + /_/ |_\___/\__, /_/ /_/ /_/\___/\__/_/ /_/\___/____/ + /____/ + + Start monitoring your Node.js application today + + $ pm2 monitor + + To know more about the PM2 monitoring solution: + + https://keymetrics.io/ + + -------------