<code>
require "net/ssh" require 'net/ssh/shell' require 'capistrano/rails' require 'sshkit' require 'sshkit/dsl' include SSHKit::DSL @hostname = "lwa1001.env-10-100-222.iagcloud" @username = "admin" @password = "password1" @cmd = "ls -la" res = "" ssh = Net::SSH.start(@hostname, @username, :password => @password) do |ssh| ssh.shell do |sh| path="/cguclaim/virtual/data/logs/gwlogs/ClaimCenter/" path="/claims_virt/inout/" require 'pry'; binding.pry; res = ssh.exec! (@cmd) do |channel, stream, data| Dir.chdir('/destination_directory') Dir.glob('*').select {|f| File.directory? f} end puts res rescue puts "Unable to connect to #{@hostname} using #{@username}/#{@password}" end # res = ssh.exec!(@cmd) # if Dir.exist?(path) && File.directory?(path) # puts "Directory exists" # else # puts "Directory not found" # end
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)