diff --git a/bin/pm2 b/bin/pm2 index 2ce68c77..6ca78076 100755 --- a/bin/pm2 +++ b/bin/pm2 @@ -18,7 +18,7 @@ var cst = require('../constants.js'); var pkg = require('../package.json'); commander.version(pkg.version) - .option('-v --verbose', 'verbose level') + .option('-v --version', 'get version') .option('-s --silent', 'hide all messages', false) .option('-m --mini-list', 'display a compacted list without formatting') .option('-f --force', 'force actions') @@ -454,7 +454,11 @@ if (process.argv.length == 2) { // in file Satan.js, method Satan.launchRPC // process.once('satan:client:ready', function() { - commander.parse(process.argv); + CLI.getVersion(function(err, remote_version) { + if (!err && (pkg.version != remote_version)) + console.log('>>>> In-memory PM2 is out-of-date, do :\n>>>> $ pm2 updatePM2'); + commander.parse(process.argv); + }); }); // diff --git a/lib/CLI.js b/lib/CLI.js index 2d1c9304..fbeb6d0c 100644 --- a/lib/CLI.js +++ b/lib/CLI.js @@ -110,6 +110,12 @@ CLI.startFile = function(script) { }); }; +CLI.getVersion = function(cb) { + Satan.executeRemote('getVersion', {}, function(err, version) { + cb ? cb.apply(null, arguments) : exitCli(cst.SUCCESS_EXIT); + }); +}; + /** * Use a RPC method on the json file * @param {string} action RPC Method @@ -858,7 +864,6 @@ CLI.unsubscribe = function(email) { }); }; - // // Private methods // diff --git a/scripts/install.js b/scripts/install.js index 262a690d..3d15ac28 100644 --- a/scripts/install.js +++ b/scripts/install.js @@ -31,7 +31,8 @@ q.askOne({ info: 'Would you like to receive an email when pm2 or your server goe q.askOne({ info: 'Email' }, function(email){ WatchDog.createConfFile(email, function() { console.log('Thanks for your subscription, if pm2 goes offline for more that 1min, you will be notified.'); - console.log('\nTo update current pm2 please do :\npm2 updatePM2\n'); + //console.log('\nTo update current pm2 please do :\n$ pm2 updatePM2'); + process.exit(0); }); }); }