New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Whenever tasks not running on Rails 4 #500
Comments
what is |
What happens if you run the command manually (without logging)?
|
I'm having a similar problem, the cron command runs from the command line, but not from the job: This runs in terminal under user 'deploy': /bin/bash -l -c 'cd /home/deploy/ebr-dev.delaris.com/releases/20141111223158 && RAILS_ENV=production bundle exec rake openstudio:simulation_update --silent' No errors in the cron log, but the task is not completed. On the other hand, specifying the environment as a command lets the task complete: /bin/bash -l -c 'cd /home/deploy/ebr-dev.delaris.com/current && (RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.2 RAILS_ENV=production ~/.rbenv/bin/rbenv exec bundle exec rake openstudio:simulation_update)' from schedule.rb: every 1.minute do
#rake "open studio:simulation_update" # <- fails
command "cd /home/deploy/ebr-dev.delaris.com/current && (RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.2 RAILS_ENV=production ~/.rbenv/bin/rbenv exec bundle exec rake openstudio:simulation_update)" # <- succeeds
end |
Hi All, i able to run the command below on the terminal and the got the correct result
but when i put it in the schedule.rb, it is not working
Kindly advise. |
I got the same problem, you have to specify the 'rake' path to make it work.
In schedule.rb
|
I've been in a circular loop on this...
The only difference is that in my production schedule.rb, my task is set to run every 1.day, :at=>'1:00am', and in my test version, my task was set to run every 1.minute |
I followed what was here and it worked. |
I had this same problem with Rails 4 + Capistranov3 + whenever.
Problem is that capistrano-bundler overwrites the bin directory. |
@soheildanesh This worked, Thanks! |
@javan 1 # Begin Whenever generated tasks for: order_flow
2 * * * * * /bin/bash -l -c 'cd /home/deploy/weishop_deploy/current && bin/rails runner -e production '\''Spree::Order.order_flow'\'''
3
4 # End Whenever generated tasks for: order_flow |
In addition to defining the full path to Rake I also needed to define the full path to Bundle in order for it to work. For me the cron job is run as root so what you can try is to run the command as root to see if you get any error messages. |
I am not able to get any issue in this locally.
My schedule.rb is
Rake task is
Log file tail is
Cron created is
|
I got same issue that task does not work with cron. same as others, specifying absolute path to take solved it. Finally, found that people create |
You should have ran whenever --update-crontab, this would start your scheduled task, you have set the output to "#{path}/log/cron.log", then go and look in that file |
Ubuntu 16.04, rbenv, Capistrano, whenever, Rails 5
|
Note askrynnikov's solution also works on Ubuntu 14.04, rbenv, Capistrano, whenever, Rails 4.2.x |
This took me HOURS to figure out. Everyone was talking about rbenv being simplistic and better than rvm, and it caused me so many issues. @askrynnikov's solution did not work alone. I had to add |
Can we close this since it's stale and no interaction with has been made in years ? @benlangfeld |
Definitely! |
Googled around a bunch and couldn't find a good answer for this.
I set up whenever per the docs in my rails 4.1.6 app, and am having it run a simple task in schedule.rb:
Order.rb:
Running 'whenever' results in the output:
The cron.log file is not written to, nor does the method actually get called. The output of
crontab -l
does indeed list the job there.Thoughts?
The text was updated successfully, but these errors were encountered: