Skip to content

Kevalin/node-shell-cmd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-shell-cmd

exec more commands of linux-servers in the same time asynchronously.

Install

npm install node-shell-cmd

Usage

var nodeShell = require('node-shell-cmd');

// format infomations of password
var passwordInfos = nodeShell.makeLoginPassword(['192.168.1.1', '192.168.1.2'], 22, 'root', '123456');

// format infomations of privateKey
var privateKeyInfos = nodeShell.makeLoginPassword(['192.168.1.1', '192.168.1.2'], 22, 'root', '$HOME/.ssh/id_rsa.pub');

// exec linux-shell
nodeShell.exec(passwordInfos, 'uptime', function(err, r) {
    if (err) return console.log(err);
    console.log(r);
});

nodeShell.exec(privateKeyInfos, 'uptime', function(err, r) {
    if (err) return console.log(err);
    console.log(r);
});

About

use node.js to exec linux-shell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published