Project

General

Profile

rake aborted! cannot load such file -- /var/www/redmine/Rakefile

Added by jerome l about 11 years ago

Dear all,

i would like to run the redmine:email:imap task via cron but it's not working.
here are my configuration details
Environment:
Redmine version 2.3.1.stable
Ruby version 1.9.3 (i486-linux)
Rails version 3.2.13
Environment production
Database adapter Mysql2
Redmine plugins:
no plugin installed

when I run whereis rake, i have the following output
/usr/local/bin/rake

and this is my cron task that I set via my user - crontab -e

cd /var/www/redmine/ && /usr/local/bin/rake redmine:email:receive_imap RAILS_ENV="production" host=mail.***.ch username=support2@******* password=**** port=143 project=support allow_override=project unknown_user=accept --trace

I have also tried this one
cd /var/www/redmine/ && /usr/local/bin/rake -f redmine:email:receive_imap RAILS_ENV="production" host=mail.***.ch username=support2@******* password=**** port=143 project=support allow_override=project unknown_user=accept --trace

here is the email that sent the cron daemon

From: root@redmine (Cron Daemon)
To: redmine@redmine
Subject: Cron <redmine@REDMINE> cd /var/www/redmine/ && /usr/local/bin/rake redmine:email:receive_imap RAILS_ENV="production" host=mail.****.ch username=support2@***.org password=*** port=143 project=winmedia-support allow_override=project unknown_user=accept --trace
Content-Type: text/plain; charset=UTF-8
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/redmine>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=redmine>
Message-Id: <E1UpFI6-0005pj-9x@REDMINE>
Date: Wed, 19 Jun 2013 12:07:02 +0200

rake aborted!
cannot load such file -- /var/www/redmine/Rakefile
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:589:in `raw_load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:89:in `block in load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/var/lib/gems/1.9.1/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'

I am a bit confused and lost on this erros as it seems very simple when I read the documentation and I did'nt find the same issue on the forums or internet.

thanks in advance for your time and help, I really need to make that work.


Replies (2)

RE: rake aborted! cannot load such file -- /var/www/redmine/Rakefile - Added by jerome l about 11 years ago

hi
does someone have some idea to try ? i have searched all night and still stuck... here is my bundle list if it can hel*** LOCAL GEMS ***

actionmailer (3.2.13)
actionpack (3.2.13)
activemodel (3.2.13)
activerecord (3.2.13)
activeresource (3.2.13)
activesupport (3.2.13)
arel (3.0.2)
builder (3.0.4, 3.0.0)
bundler (1.3.5)
capybara (2.0.3)
childprocess (0.3.9)
coderay (1.0.9)
daemon_controller (1.1.4)
erubis (2.7.0)
ffi (1.9.0)
hike (1.2.3)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.0.3)
json (1.8.0)
mail (2.5.4)
metaclass (0.0.1)
mime-types (1.23)
mini_portile (0.5.0)
mocha (0.13.3)
multi_json (1.7.6)
mysql2 (0.3.11)
net-ldap (0.3.1)
nokogiri (1.6.0)
passenger (4.0.5)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-openid (1.3.1)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.13)
railties (3.2.13)
rake (10.0.4)
rdoc (4.0.1, 3.12.2)
rmagick (2.13.2)
ruby-openid (2.1.8)
rubyzip (0.9.9)
selenium-webdriver (2.33.0)
shoulda (3.3.2)
shoulda-context (1.0.2)
shoulda-matchers (1.4.1)
sprockets (2.2.2)
thor (0.18.1)
tilt (1.4.1)
treetop (1.4.14)
tzinfo (0.3.37)
websocket (1.0.7)
xpath (1.0.0)
yard (0.8.6.1)

any logs to check?

RE: rake aborted! cannot load such file -- /var/www/redmine/Rakefile - Added by jerome l about 11 years ago

I have finally found the solution, this is the command gem env which outputs

Gem env

root@REDMINE:/var/www/redmine/script# gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i486-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby1.9.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /var/lib/gems/1.9.1
- /root/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/

so my ruby is owned by root and I was running my cron as user !!

just write the task in root crontab and it works like a charm !!!

hope this will help someone in the future :)

see you

    (1-2/2)