Wednesday, 17 May 2017

how can i know the PID for this code OR I want to exit the command without closing the command prompt?

**I want to kill the process of the 'trail' command without closing the putty/command prompt OR how can I run the same command in background process OR how can i know PID for this **

var Client = require('ssh2').Client;
var conn = new Client();
conn.on('ready', function() {
  console.log('Client :: ready');
  conn.exec('trail', function(err, stream) {
    if (err) throw err;
    stream.on('close', function(code, signal) {
      console.log('Stream :: close :: code: ' + code + ', signal: ' + signal);
      conn.end();
    }).on('data', function(data) {
      console.log('STDOUT: ' + data);
    }).stderr.on('data', function(data) {
      console.log('STDERR: ' + data);
    });
  });
}).connect({
  host: '192.168.100.100',
  port: 22,
  username: 'frock',
  password: 'frylk'
});

As I am new to NodeJS please help me .



via vinay

No comments:

Post a Comment