0 Replies - 298 Views - Last Post: 23 May 2021 - 09:47 AM Rate Topic: -----

#1 aldron   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-May 21

python paramiko remote execution of local script

Posted 23 May 2021 - 09:47 AM

I am trying to run my local bash script on remote server without copying it into remote server. It is as simple as following for test purpose. There are more than a few servers where it runs perfectly, but in some server running tcsh, there is an issue. How do i envoke bash, if following does not work. Below is dummy test.sh

    echo $a
    echo $SHELL

I am using python paramiko, exec_command for remote execution as following:

    my_script = open("test.sh").read()
    stdin, stdout, stderr = ssh.exec_command(my_script, timeout=15)
    err = stderr.read().decode()
    if err:

Given, that connection works and same script works for other servers with bash default shell.
This is the output that i get:

    printing from errors
    a=test: Command not found.
    a: Undefined variable.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1