DEV Community

Discussion on: SSH Shortcuts

Collapse
 
chintukarthi profile image
Karthikeyan Dhanapal

Hi. I am having doubts regarding using the ssh login to check the server status with child_process module. Is that something that you can help me with? Thanks.

Collapse
 
hoelzro profile image
Rob Hoelz

I can try; I'm not sure which child_process module you're referring to, though. Do you have some code I could look at?

Collapse
 
chintukarthi profile image
Karthikeyan Dhanapal

yeah,
This is a coffescript for hubot.

code :

---> Code Starts here

child_process = require 'child_process'
module.exports = (robot) ->
robot.respond /check status/i, (res) ->

child_process.exec("sshpass -p 'password' ssh username@hostname", (err, stdout, stderr) ->
  if err
    console.log(err)
  else
    console.log(stdout)
)

       ----> code ends here

Actually the problem is i'm not sure whether the syntax for child_process is correct. I am new to coffeescript and hubot. So i don't know how to resolve this

Thread Thread
 
hoelzro profile image
Rob Hoelz

I have no familiarity with CoffeeScript or Node's child_process module, so I don't know how much help I'll be, but I'll try! Are you getting an error message or anything?

Thread Thread
 
chintukarthi profile image
Karthikeyan Dhanapal

yeah. Error : Response not OK: no_text.

I think passing the shell commands within the child_process has some issues. If you come up with any solution or something related to that, please let me know. Thanks.