Execute Command

You can execute command to a remote server via SSH.

Usage

execCommand(<properties>)
let properties = {
    {Object} [sshConfig] - Connection Configurations. (more info: https://www.npmjs.com/package/node-ssh)
    {string} [command] - Command to run on remote server
    {number} [timeout] - Timeout - default: 30 seconds.    
}
tests/sample1.js
/* LIBRARIES
*************/
const { sente } = require('#libraries');
const { execCommand } = sente;

/* TEST FLOW
*************/
test = async () => {
   
    // SSH config
     let sshConfig = {
        host: '1.1.1.1' ,
        username: '<username>',
        password: '<password>',
    };
    
    // Run Command
    await ssh.execCommand({command: 'ls', sshConfig: sshConfig})  

Last updated