On Tue, 11 Oct 2005 04:08:35 +0900, Jamis Buck wrote: > On Oct 10, 2005, at 1:01 PM, bob wrote: > >>> See the last paragraph of http://net-ssh.rubyforge.org/ >>> chapter-3.html#s2. Basically, session.loop accepts an optional block >>> that should return true as long as the loop should continue. >>> >>> Normally, the loop continues while all channels are open, but in your >>> case, a tail -f will never close by itself. >>> >>> - Jamis >>> >> >> That's as much as I had worked out. Reading the guide suggested to >> me that >> it wasn't ending because the channel was still open, so I started >> trying >> to use channel.close in various places to make it close, but it >> never did >> what I wanted it to do. I did get it to close & end the script, but >> only before the result of "tail /var/log/messages" was output to >> the shell >> (or browser, when run as a cgi script). I didn't know where to begin, >> when it came to adding an optional block of code, and didn't start >> because >> I wasn't 100% that was what I needed to do. >> >> Any clues anyone, please ? I'm going to have a go at working out >> what I >> should do, but would greatly appreciate the answer from >> someone who knows :-) > > Can you post an example of one of the scripts where you were doing > channel.close? Under what conditions do you want the channel to close? > > - Jamis None of the scripts I am trying to write are earth shattering. They (will eventually) simply consist of running a script or a few commands piped together on a remote server, grabbing & parsing the output to get some variables, then building a web page containing those variables. None of the scripts I want to get done have gone beyond dumping the output I want to the shell at this point in time, because I want to know how to close that ssh connection. I think just knowing what I need to do to the script already given, to make it end gracefully, would solve my problem.