как видишь
function server1 (){
var hostParamsArray = new Array();
hostParamsArray[0] = { host: '', port: 22, username: '', password: '' };
hostParamsArray[1] = { host: '', port: 22, username: '', password: '' };
var command = "", conn = [];
for (var i = 0; i < hostParamsArray.length; i++) {
conn[i] = new Client();
conn[i].on('ready', function() {
logger.info('SSH Successful connection: Server#' +(i + 1));
command = "touch test.log";
conn[i].exec(command,function(err, stream) {
if (err) throw err;
stream.on('close', function() {
console.log('Stream :: close');
conn[i].end();
}).on('data', function(data) {
console.log('STDOUT: ' + data);
if(data.indexOf('123') + 1){
logger.info('Update');
}
}).stderr.on('data', function(data) {
console.log('STDERR: ' + data);
});
});
}).connect(hostParamsArray[i])
conn[i].on('error', function(err) {
console.log(err);
});
}}
conn[i].exec(command,function(err, stream) {
^
TypeError: Cannot read property 'exec' of undefined
в том разделе почти не помогают..