Reputation: 2681
I am trying to run rake task in cron job like this
0 * * * * cd /var/www/rails_path/rails && rake my_task RAILS_ENV=production
I can run this command
cd /var/www/rails_path/rails && rake my_task RAILS_ENV=production
from shell and got result.
And I checked the cron log the commond did get run. But in fact the rake task didn't get run when the cron job excutes (the task should have logs, I didn't see logs of this rake task after cron job ran).
What is the issue?
UPDATED:
tried
0 * * * * /bin/bash -l -c "cd /var/www/rails_path/rails && rake my_task RAILS_ENV=production"
no luck
installed whenever
gem and have
every 2.minutes do
rake "my_task"
end
in ./config/schdule.rb. It was not running at all (I deployed rails in nginx with passenger).
Thanks
Upvotes: 0
Views: 3243