D
Daniel Berger
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?
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
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?
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