How can i execute 2 or more commands in the same ssh session?

前端 未结 7 1355
南方客
南方客 2021-01-06 01:14

I have the following script:

#!/usr/bin/env ruby
require \'rubygems\'
require \'net/ssh\'

Net::SSH.start(\'host1\', \'root\', :password => \"mypassword1\         


        
7条回答
  •  北荒
    北荒 (楼主)
    2021-01-06 01:50

    The current location of net-ssh-shell is changed.

    What I decided to use though to call a random shell script is to scp a file to the remote machine and source it into shell. Basically doing this: File.write(script_path, script_str) gear.ssh.scp_to(script_path, File.dirname(script_path)) gear.ssh.exec(". script_path")

提交回复
热议问题