# Help - Linux?

**URL:** <https://www.ruby-forum.com/t/help-linux/129736>\
**Category:** Ruby\
**Created:** [February 21, 2008, 5:25am UTC](https://www.ruby-forum.com/t/help-linux/129736 "2008-02-21T05:25:43Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 21, 2008, 5:25am UTC](https://www.ruby-forum.com/t/help-linux/129736/1 "2008-02-21T05:25:43Z")

</div>

Would somebody please try this on Linux for me. It works fine on  
Windows but hangs on Fedora.

Thanks,

#!/usr/bin/ruby

require ‘net/ftp’

def getMetar(id)  
metar = Array.new  
i = 0  
ftp = Net::FTP.new(‘[tgftp.nws.noaa.gov](http://tgftp.nws.noaa.gov)’)  
puts ftp.login  
puts ftp.sendcmd(‘PASV’)  
ftp.chdir(‘/data/observations/metar/stations’)  
ftp.gettextfile(“#{id.upcase}.TXT”) do |line|  
metar[i] = line  
i = i + 1  
end  
ftp.close  
return metar  
end

puts getMetar(“KBFL”)

–

Knute Johnson  
email s/nospam/knute/

---

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 21, 2008, 5:30am UTC](https://www.ruby-forum.com/t/help-linux/129736/2 "2008-02-21T05:30:25Z")

</div>

> > getMetar(“KBFL”)  
> > 230 Login successful.  
> > 227 Entering Passive Mode (140,90,128,71,21,205)  
> > =\> [“2008/02/21 03:54”, “KBFL 210354Z 00000KT 10SM CLR 09/06 A3005 RMK  
> > AO2  
> > SLP176 T00890061”]
> 
> >

Works for me! 🙂

Arlen

---

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 21, 2008, 6:10am UTC](https://www.ruby-forum.com/t/help-linux/129736/3 "2008-02-21T06:10:50Z")

</div>

Arlen C. wrote:

> Arlen

Thanks very much, any ideas why it doesn’t for me?

–

Knute Johnson  
email s/nospam/knute/

---

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 21, 2008, 6:14am UTC](https://www.ruby-forum.com/t/help-linux/129736/4 "2008-02-21T06:14:22Z")

</div>

Not a clue, I’m afraid. You’ll need to dig deeper into what’s happening  
on  
the network, probably.

Cheers,  
Arlen

---

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 21, 2008, 6:35am UTC](https://www.ruby-forum.com/t/help-linux/129736/5 "2008-02-21T06:35:27Z")

</div>

Knute Johnson wrote:

> > Works for me! 🙂
> > 
> > Arlen
> 
> Thanks very much, any ideas why it doesn’t for me?

Step one: install a command line FTP client. I use “lftp”, but there are  
others. Then type

lftp [tgftp.nws.noaa.gov](http://tgftp.nws.noaa.gov)  
lftp [tgftp.nws.noaa.gov](http://tgftp.nws.noaa.gov):~\>

If you don’t get that prompt, there’s something disconnected between  
your client and the server. You’ll need to talk to your network  
adminstrator to diagnose what’s broken.

But if you _do_ get the prompt, the network is working but the Ruby  
client isn’t. There’s probably something wrong with your Ruby  
installation. Reinstall Ruby. Try again

---

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 21, 2008, 6:45am UTC](https://www.ruby-forum.com/t/help-linux/129736/6 "2008-02-21T06:45:59Z")

</div>

On Wed, Feb 20, 2008 at 10:24 PM, Knute Johnson  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Would somebody please try this on Linux for me. It works fine on  
> Windows but hangs on Fedora.

I ran this script:

true && (  
set -x  
cat /etc/issue.net  
ruby -v  
cat ftp.rb  
./ftp.rb  
) \>& output.txt

Here’s the content of output.txt:

$ cat output.txt

- cat /etc/issue.net  
Ubuntu 7.10
- ruby -v  
ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
- cat ftp.rb  
#!/usr/bin/ruby

require ‘net/ftp’

def getMetar(id)  
metar = Array.new  
i = 0  
ftp = Net::FTP.new(‘[tgftp.nws.noaa.gov](http://tgftp.nws.noaa.gov)’)  
puts ftp.login  
puts ftp.sendcmd(‘PASV’)  
ftp.chdir(‘/data/observations/metar/stations’)  
ftp.gettextfile(“#{id.upcase}.TXT”) do |line|  
metar[i] = line  
i = i + 1  
end  
ftp.close  
return metar  
end

puts getMetar(“KBFL”)

- ./ftp.rb  
230 Login successful.  
227 Entering Passive Mode (140,90,128,71,211,81)  
2008/02/21 04:54  
KBFL 210454Z 00000KT 10SM CLR 08/06 A3006 RMK AO2 SLP179 T00830061

Regards,

- Robert

---

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 21, 2008, 6:55am UTC](https://www.ruby-forum.com/t/help-linux/129736/7 "2008-02-21T06:55:58Z")

</div>

M. Edward (Ed) Borasky wrote:

> your client and the server. You’ll need to talk to your network  
> adminstrator to diagnose what’s broken.
> 
> But if you _do_ get the prompt, the network is working but the Ruby  
> client isn’t. There’s probably something wrong with your Ruby  
> installation. Reinstall Ruby. Try again

The command line client works just fine. I removed and reinstalled ruby  
and the problem still exists. Is there some library I have to install  
too for the FTP class?

–

Knute Johnson  
email s/nospam/knute/

---

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 21, 2008, 7:07am UTC](https://www.ruby-forum.com/t/help-linux/129736/8 "2008-02-21T07:07:06Z")

</div>

On Thu, Feb 21, 2008 at 7:59 AM, Knute Johnson  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Robert C. wrote:
> 
> > On Wed, Feb 20, 2008 at 10:24 PM, Knute Johnson  
> > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > 
> > > Would somebody please try this on Linux for me. It works fine on  
> > > Windows but hangs on Fedora.

You might want to “gem install ruby-debug”, put this at the top of your  
program:

require ‘ruby-debug’  
Debugger.start  
debugger #start irb

…and then use “s” to step through each line and see exactly  
where the hang-up is. Might be a threading issue.

Les

---

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 21, 2008, 7:00am UTC](https://www.ruby-forum.com/t/help-linux/129736/9 "2008-02-21T07:00:39Z")

</div>

Robert C. wrote:

> ruby -v  
> ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]  
> puts ftp.sendcmd(‘PASV’)
> 
> - ./ftp.rb  
> 230 Login successful.  
> 227 Entering Passive Mode (140,90,128,71,211,81)  
> 2008/02/21 04:54  
> KBFL 210454Z 00000KT 10SM CLR 08/06 A3006 RMK AO2 SLP179 T00830061
> 
> Regards,
> 
> - Robert

OK, so it’s not a Linux problem it’s my Linux problem.

–

Knute Johnson  
email s/nospam/knute/

---

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 21, 2008, 11:28pm UTC](https://www.ruby-forum.com/t/help-linux/129736/10 "2008-02-21T23:28:11Z")

</div>

Leslie V. wrote:

> require ‘ruby-debug’  
> Debugger.start  
> debugger #start irb
> 
> …and then use “s” to step through each line and see exactly  
> where the hang-up is. Might be a threading issue.
> 
> Les

Les:

I tried this but get the following error

metar.rb:6:in `require’: no such file to load – ruby-debug (LoadError)  
from metar.rb:6

There is no ruby-debug package that I can find for Fedora. I tried  
loading rubygems.noarch but that didn’t help. There has to be something  
simple I’m missing here, I just don’t know what it is.

Thanks,

–

Knute Johnson  
email s/nospam/knute/

---

<div class="post-metadata">

**Author:** ![Knute\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/958977/32.png) [@Knute\_Johnson](https://www.ruby-forum.com/u/Knute_Johnson)\
**Post date:** [February 22, 2008, 6:04am UTC](https://www.ruby-forum.com/t/help-linux/129736/11 "2008-02-22T06:04:55Z")

</div>

> > You might want to “gem install ruby-debug”, put this at the  
> > top of your  
> > program:

require ‘rubygems’
