Thursday, 13 April 2017

Simple-ssh doesn't work anymore

I was trying to send variable in the text of ssh command, but suddenly my commands stopped working even without variables, inspite of it worked perfectly yesterday. What have I ruined? Made too many sessions? How to fix this? Please, help.

My old code:

Meteor.methods({
sendDataToMixer: function(){
var SSH = require('simple-ssh');
var ssh = new SSH({
    host: 'host',
    user: 'user',
    pass: 'pass'
});

ssh
.exec('echo "mkdir dir123"', {
    out: console.log.bind(console)
})
.start();
}
}); 

What I tried to make:

Meteor.methods({
sendDataToMixer: function(){
var SSH = require('simple-ssh');
var name = "name1";
var ssh = new SSH({
    host: 'host',
    user: 'user',
    pass: 'pass'
});

ssh
.exec('echo "mkdir ' + name + '"', {
    out: console.log.bind(console)
})
.start();
}
}); 

I also wrote output to a log.txt, it shows what my commands reached the remote server, but I still don't understand why they weren't executed



via Solonka

No comments:

Post a Comment