From: locky thindromen Date: 2012-07-27T04:08:10+09:00 Subject: Re: help with net-ssh shell-script timing update: i've gotten a bit further, i can now at least get the program to spit out the data i need... but it does it in an infinite loop >_> SSH.start(host, user){|ssh| ssh.open_channel{|channel| #get root privelages #configure behavior of channel channel.on_data{|channel, data| puts "#{data}" if data =~ /^Password:/ channel.send_data("#{PASSWORD}\n") elsif data =~ /root@/ channel.exec("tail /some/log/file.txt") channel.on_data{"STOP LOOPING, DAMN YOU!"} end channel.on_close... (etc.) channel.request_pty do |ch,success| if success puts "pty successfully obtained" else puts "could not obtain pty" end end channel.exec("sudoshell"){|channel, win| #custom sudo script. if win puts "ss command sent" else puts "ss command FAIL" end } ...end if i put the 2nd command anywhere but within an on_data if clause, it refuses to wait for the sudoshell to finish loading, all attempts to use a sleep, or wait command just result in it hanging forever. could really use any advice on this one. thanks ~Locky -- Posted via http://www.ruby-forum.com/.