notification message when in-memory pm2 is outdated

This commit is contained in:
tknew2 2014-05-16 14:43:49 +02:00
parent 9e6fcb1bed
commit 6c6ce3be38
3 changed files with 14 additions and 4 deletions

View File

@ -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);
});
});
//

View File

@ -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
//

View File

@ -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);
});
});
}