From: "Ara.T.Howard" Date: 2005-09-24T03:27:31+09:00 Subject: Re: net/ftp works manually, fails via cron On Sat, 24 Sep 2005, Daniel Berger wrote: > Hi all, > > Ruby 1.8.2 > Solaris 10, Linux 2.6.8 > > I'm experiencing something odd with net/ftp. When I run the following > snippet manually it works fine. Running the same snippet under cron seems to > fail. > > I don't get any messages in the log file. No indication whatsoever that > there was a problem. It's just that...nothing happens. There is no file > transfer as far as I can see when run via cron. > > Any ideas? path to ruby is fubar under cron? what's the shebang line and cron line? > > Regards, > > Dan > > # ftptest.rb > require "net/ftp" > include Net > > host = "some_host" > log_file = "ftptest.log" > > fh = File.open(log_file, "w+") > > begin > ftp = FTP.new(host) > ftp.login("djberge", "xxxxx") > ftp.chdir("local") > ftp.gettextfile("text.temp") > rescue Exception => err > fh.puts("FTP ERROR: #{err}") > raise > else > fh.puts("Got file") > end > > begin > ftp.puttextfile("upload_test.txt") > rescue Exception => err > fh.puts("FTP ERROR: #{err}") > raise > else > fh.puts("Put file") > end > > ftp.close > fh.close > -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================