Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8554233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:50:05+00:00 2026-06-11T14:50:05+00:00

I have a rake task that connects to an ftp server, downloads a file,

  • 0

I have a rake task that connects to an ftp server, downloads a file, and then gunzips it. This works locally, but when I run the task on my heroku cedar server I get no feed back after executing net::ftp.getbinaryfile.

Here is the code to download the file:

tempfile = "#{Rails.root}/tmp/#{Process.pid}_#{MyApp::Application.config.products_bbcom_file}"
      ftp = Net::FTP.new()
      puts "connecting to ftp server #{MyApp::Application.config.products_bbcom_host}"
      ftp.connect(MyApp::Application.config.products_bbcom_host)
      puts "logging in"
      ftp.login(MyApp::Application.config.products_bbcom_user,MyApp::Application.config.products_bbcom_pass)
      puts "changing directory"
      files = ftp.chdir(MyApp::Application.config.products_bbcom_path)
      #files = ftp.list('n*')
      puts "downloading file #{MyApp::Application.config.products_bbcom_file} to #{tempfile}"
      ftp.getbinaryfile(MyApp::Application.config.products_bbcom_file, tempfile, 1024)
      ftp.close      

When I execute the task on heroku: heroku run rake db:import and tail the logs I see:

2012-09-10T16:26:24+00:00 heroku[run.1]: Awaiting client
2012-09-10T16:26:24+00:00 heroku[run.1]: Starting process with command `bundle exec rake db:import`
2012-09-10T16:26:25+00:00 heroku[run.1]: State changed from starting to up

And the out put from the task gets to:

== Starting ==
Connecting to database specified by DATABASE_URL
connecting to ftp server datatransfer.cj.com
logging in
changing directory
downloading file

The script gets to the point where it is trying to download the file to #{Rails.root}/tmp/ but then never responds again. This only takes a couple seconds locally, but I waited a few minutes and the task doesn’t do anything.

From the heroku dev site it seems like you can save files to #{Rails.root}/tmp/ on cedar. Is this possible? If so am I taking the wrong approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:50:06+00:00Added an answer on June 11, 2026 at 2:50 pm

    It is possible to download a file vit NET::FTP, but heroku only supports PASSIVE mode FTP. I needed to specify that I wanted to use passive mode. Here is a simplified example:

    ftp = Net::FTP.new()
    ftp.passive = true
    ftp.connect(host)
    ftp.login(username,password)
    files = ftp.chdir(path_to_file)
    ftp.getbinaryfile(filename, tempfile, 1024)
    ftp.close
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rake task that must be always run. But sometimes this task
I have a rake task that uploads a list of files via ftp. Copying
I want to have a rake task that reads a HAML file and creates
I have a rake task that downloads an XML document through HTTP and writes
I have rails application that connects to multiple databases. I wrote custom rake task
I have a rake task that is called from another rake task. In this
I have a rake task that pulls and parses JSON data over an SSL
In my rails application I have a rake task that reads emails using imap.
I have this little rake task: namespace :db do namespace :test do task :reset
I have a rake task that runs, quite a lot of code. At the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.